Skip to content

Commit

Permalink
formatting, PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
randomanderson committed Jul 25, 2024
1 parent 6efd5be commit 0553e25
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .gitlab/download-dependency-wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ mkdir pywheels-dep

cd pywheels

export PYTHONUNBUFFERED=TRUE

../lib-injection/dl_wheels.py \
--python-version=$PYTHON_VERSION \
--local-ddtrace \
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/prepare-oci-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fi
if [ -z "$PYTHON_PACKAGE_VERSION" ]; then
# Get the version from the filename of the first wheel
# wheels have the form:
# ddtrace-2.11.0.dev41+g50bf57680-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.wh
# ddtrace-2.11.0.dev41+g50bf57680-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
# the version is everything between the first and second "-"
WHEELS_LIST=(../pywheels/*.whl)
FIRST_WHEEL=${WHEELS_LIST[1]}
Expand Down
25 changes: 11 additions & 14 deletions lib-injection/dl_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
print(
"WARNING: using known incompatible version, %r, of pip. The minimum compatible pip version is %r"
% (pip_version, MIN_PIP_VERSION),
flush=True
)

# Supported Python versions lists all python versions that can install at least one version of the ddtrace library.
Expand Down Expand Up @@ -73,12 +72,12 @@
args = parser.parse_args()

dl_dir = args.output_dir
print("saving wheels to %s" % dl_dir, flush=True)
print("saving wheels to %s" % dl_dir)


for python_version, platform in itertools.product(args.python_version, args.platform):
for arch in args.arch:
print("Downloading %s %s %s wheel" % (python_version, arch, platform), flush=True)
print("Downloading %s %s %s wheel" % (python_version, arch, platform))
abi = "cp%s" % python_version.replace(".", "")
# Have to special-case these versions of Python for some reason.
if python_version in ["2.7", "3.5", "3.6", "3.7"]:
Expand All @@ -87,14 +86,12 @@
if args.ddtrace_version:
ddtrace_specifier = "ddtrace==%s" % args.ddtrace_version
elif args.local_ddtrace:
wheel_files = [f for f in os.listdir('.') if
f.endswith(".whl")
and abi in f
and platform in f
and arch in f]

if (len(wheel_files) > 1):
print("More than one matching file found %s" % wheel_files, flush=True)
wheel_files = [
f for f in os.listdir(".") if f.endswith(".whl") and abi in f and platform in f and arch in f
]

if len(wheel_files) > 1:
print("More than one matching file found %s" % wheel_files)
sys.exit(1)

ddtrace_specifier = wheel_files[0]
Expand All @@ -119,20 +116,20 @@
abi,
"--only-binary=:all:",
"--exists-action",
"i", #ignore redownloads of same wheel
"i", # ignore redownloads of same wheel
"--dest",
dl_dir,
]
if args.verbose:
print(" ".join(cmd), flush=True)
print(" ".join(cmd))

if not args.dry_run:
subprocess.run(cmd, capture_output=not args.verbose, check=True)

wheel_files = [f for f in os.listdir(dl_dir) if f.endswith(".whl")]
for whl in wheel_files:
wheel_file = os.path.join(dl_dir, whl)
print("Unpacking %s" % wheel_file, flush=True)
print("Unpacking %s" % wheel_file)
# -q for quieter output, else we get all the files being unzipped.
subprocess.run(
[
Expand Down

0 comments on commit 0553e25

Please sign in to comment.