diff --git a/Makefile b/Makefile index 0583b836c5b..91e447c0ed1 100644 --- a/Makefile +++ b/Makefile @@ -386,11 +386,11 @@ build-crossdock-fresh: build-crossdock-linux .PHONY: changelog changelog: - python3 ./scripts/release-notes.py --exclude-dependabot + ./scripts/release-notes.py --exclude-dependabot .PHONY: draft-release draft-release: - python3 ./scripts/draft-release.py + ./scripts/draft-release.py .PHONY: install-tools install-tools: diff --git a/docker-compose/monitor/README.md b/docker-compose/monitor/README.md index 732a1acb648..bb94c464e1a 100644 --- a/docker-compose/monitor/README.md +++ b/docker-compose/monitor/README.md @@ -90,7 +90,7 @@ this SPM Development Environment. Run the following commands to setup the Python virtual environment and install the Opentelemetry SDK: ```shell -python -m venv .venv +python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt ``` diff --git a/scripts/draft-release.py b/scripts/draft-release.py index 0214c98f814..14a20a28689 100755 --- a/scripts/draft-release.py +++ b/scripts/draft-release.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import re import subprocess diff --git a/scripts/import-order-cleanup.py b/scripts/import-order-cleanup.py old mode 100644 new mode 100755 index 1e8cbf58281..7f3ce7f640d --- a/scripts/import-order-cleanup.py +++ b/scripts/import-order-cleanup.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import argparse def cleanup_imports_and_return(imports): diff --git a/scripts/import-order-cleanup.sh b/scripts/import-order-cleanup.sh index 41f2834e0cb..3476ca9acda 100755 --- a/scripts/import-order-cleanup.sh +++ b/scripts/import-order-cleanup.sh @@ -2,7 +2,7 @@ set -e -python scripts/import-order-cleanup.py -o $1 -t $(git ls-files "*\.go" | \ +./scripts/import-order-cleanup.py -o $1 -t $(git ls-files "*\.go" | \ grep -v \ -e thrift-gen \ -e swagger-gen \ diff --git a/scripts/release-notes.py b/scripts/release-notes.py old mode 100644 new mode 100755 index 928a9a5d9cd..2034502c3e6 --- a/scripts/release-notes.py +++ b/scripts/release-notes.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + # This script can read N latest commits from one of Jaeger repos # and output them in the release notes format: # * {title} ({author} in {pull_request}) @@ -5,7 +7,7 @@ # Requires personal GitHub token with default permissions: # https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token # -# Usage: python release-notes.py --help +# Usage: ./release-notes.py --help # import argparse diff --git a/scripts/updateLicense.py b/scripts/updateLicense.py old mode 100644 new mode 100755 index 0f577862380..7c8ed089377 --- a/scripts/updateLicense.py +++ b/scripts/updateLicense.py @@ -1,6 +1,4 @@ -from __future__ import ( - absolute_import, print_function, division, unicode_literals -) +#!/usr/bin/env python3 import logging import re diff --git a/scripts/updateLicenses.sh b/scripts/updateLicenses.sh index 0c857cbebdf..c8be58ac16b 100755 --- a/scripts/updateLicenses.sh +++ b/scripts/updateLicenses.sh @@ -2,7 +2,7 @@ set -e -python scripts/updateLicense.py $(git ls-files "*\.go" | \ +./scripts/updateLicense.py $(git ls-files "*\.go" | \ grep -v \ -e thrift-gen \ -e swagger-gen \ diff --git a/scripts/utils/ids-to-base64.py b/scripts/utils/ids-to-base64.py old mode 100644 new mode 100755 index b0022bcc0ef..8e55737dbd3 --- a/scripts/utils/ids-to-base64.py +++ b/scripts/utils/ids-to-base64.py @@ -1,30 +1,34 @@ +#!/usr/bin/env python3 + import base64 import os import re import sys + def trace_id_base64(match): id = int(match.group(1), 16) hex = '%032x' % id b64 = base64.b64encode(hex.decode('hex')) return '"traceId": "%s"' % b64 + def span_id_base64(match): id = int(match.group(1), 16) hex = '%016x' % id b64 = base64.b64encode(hex.decode('hex')) - return '"spanId": "%s"' % b64 + return f'"spanId": "{b64}"' + for file in sys.argv[1:]: - print file - backup = '%s.bak' % file + print(file) + backup = f'{file}.bak' with open(file, 'r') as fin: with open(backup, 'w') as fout: for line in fin: # line = line[:-1] # remove \n line = re.sub(r'"traceId": "(.+)"', trace_id_base64, line) line = re.sub(r'"spanId": "(.+)"', span_id_base64, line) - # print(line) fout.write(line) os.remove(file) os.rename(backup, file)