Skip to content

Commit 434836b

Browse files
authored
python wheels: do not "expand" (spack#43317)
1 parent 7b9b976 commit 434836b

File tree

39 files changed

+156
-743
lines changed

39 files changed

+156
-743
lines changed

lib/spack/llnl/url.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# Archive extensions allowed in Spack
1313
PREFIX_EXTENSIONS = ("tar", "TAR")
1414
EXTENSIONS = ("gz", "bz2", "xz", "Z")
15-
NO_TAR_EXTENSIONS = ("zip", "tgz", "tbz2", "tbz", "txz")
15+
NO_TAR_EXTENSIONS = ("zip", "tgz", "tbz2", "tbz", "txz", "whl")
1616

1717
# Add PREFIX_EXTENSIONS and EXTENSIONS last so that .tar.gz is matched *before* .tar or .gz
1818
ALLOWED_ARCHIVE_TYPES = (
@@ -403,7 +403,7 @@ def expand_contracted_extension_in_path(
403403
def compression_ext_from_compressed_archive(extension: str) -> Optional[str]:
404404
"""Returns compression extension for a compressed archive"""
405405
extension = expand_contracted_extension(extension)
406-
for ext in [*EXTENSIONS]:
406+
for ext in EXTENSIONS:
407407
if ext in extension:
408408
return ext
409409
return None

lib/spack/spack/test/llnl/url.py

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ def test_strip_compression_extension(archive_and_expected):
148148
assert stripped == "Foo.zip"
149149
stripped = llnl.url.strip_compression_extension(archive, "zip")
150150
assert stripped == "Foo"
151+
elif extension == "whl":
152+
assert stripped == "Foo.whl"
151153
elif (
152154
extension.lower() == "tar"
153155
or extension in llnl.url.CONTRACTION_MAP

lib/spack/spack/test/util/compression.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
]
3030
# Spack does not use Python native handling for tarballs or zip
3131
# Don't test tarballs or zip in native test
32-
native_archive_list = [key for key in ext_archive.keys() if "tar" not in key and "zip" not in key]
32+
native_archive_list = [
33+
key for key in ext_archive.keys() if "tar" not in key and "zip" not in key and "whl" not in key
34+
]
3335

3436

3537
@pytest.fixture
@@ -71,7 +73,9 @@ def test_native_unpacking(tmpdir_factory, archive_file_and_extension):
7173

7274
@pytest.mark.not_on_windows("Only Python unpacking available on Windows")
7375
@pytest.mark.parametrize(
74-
"archive_file_and_extension", [(ext, True) for ext in ext_archive.keys()], indirect=True
76+
"archive_file_and_extension",
77+
[(ext, True) for ext in ext_archive.keys() if "whl" not in ext],
78+
indirect=True,
7579
)
7680
def test_system_unpacking(tmpdir_factory, archive_file_and_extension, compr_support_check):
7781
# actually run test

lib/spack/spack/util/compression.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import os
1010
import shutil
1111
import sys
12-
from typing import BinaryIO, Callable, Dict, List, Optional
12+
from typing import Any, BinaryIO, Callable, Dict, List, Optional
1313

1414
import llnl.url
1515
from llnl.util import tty
@@ -157,6 +157,10 @@ def _system_gunzip(archive_file: str) -> str:
157157
return destination_abspath
158158

159159

160+
def _do_nothing(archive_file: str) -> None:
161+
return None
162+
163+
160164
def _unzip(archive_file: str) -> str:
161165
"""Returns path to extracted zip archive. Extract Zipfile, searching for unzip system
162166
executable. If unavailable, search for 'tar' executable on system and use instead.
@@ -283,26 +287,27 @@ def decompressor_for(path: str, extension: Optional[str] = None):
283287
return decompressor_for_nix(extension)
284288

285289

286-
def decompressor_for_nix(extension: str) -> Callable[[str], str]:
290+
def decompressor_for_nix(extension: str) -> Callable[[str], Any]:
287291
"""Returns a function pointer to appropriate decompression algorithm based on extension type
288292
and unix specific considerations i.e. a reasonable expectation system utils like gzip, bzip2,
289293
and xz are available
290294
291295
Args:
292296
extension: path of the archive file requiring decompression
293297
"""
294-
extension_to_decompressor: Dict[str, Callable[[str], str]] = {
298+
extension_to_decompressor: Dict[str, Callable[[str], Any]] = {
295299
"zip": _unzip,
296300
"gz": _gunzip,
297301
"bz2": _bunzip2,
298302
"Z": _system_unZ, # no builtin support for .Z files
299303
"xz": _lzma_decomp,
304+
"whl": _do_nothing,
300305
}
301306

302307
return extension_to_decompressor.get(extension, _system_untar)
303308

304309

305-
def _determine_py_decomp_archive_strategy(extension: str) -> Optional[Callable[[str], str]]:
310+
def _determine_py_decomp_archive_strategy(extension: str) -> Optional[Callable[[str], Any]]:
306311
"""Returns appropriate python based decompression strategy
307312
based on extension type"""
308313
extension_to_decompressor: Dict[str, Callable[[str], str]] = {
@@ -313,7 +318,7 @@ def _determine_py_decomp_archive_strategy(extension: str) -> Optional[Callable[[
313318
return extension_to_decompressor.get(extension, None)
314319

315320

316-
def decompressor_for_win(extension: str) -> Callable[[str], str]:
321+
def decompressor_for_win(extension: str) -> Callable[[str], Any]:
317322
"""Returns a function pointer to appropriate decompression
318323
algorithm based on extension type and Windows specific considerations
319324
@@ -323,7 +328,7 @@ def decompressor_for_win(extension: str) -> Callable[[str], str]:
323328
and files as Python does not provide support for the UNIX compress algorithm
324329
"""
325330
extension = llnl.url.expand_contracted_extension(extension)
326-
extension_to_decompressor: Dict[str, Callable[[str], str]] = {
331+
extension_to_decompressor: Dict[str, Callable[[str], Any]] = {
327332
# Windows native tar can handle .zip extensions, use standard unzip method
328333
"zip": _unzip,
329334
# if extension is standard tarball, invoke Windows native tar
@@ -333,6 +338,7 @@ def decompressor_for_win(extension: str) -> Callable[[str], str]:
333338
# detected
334339
"Z": _system_unZ,
335340
"xz": _lzma_decomp,
341+
"whl": _do_nothing,
336342
}
337343

338344
decompressor = extension_to_decompressor.get(extension)

var/spack/repos/builtin/packages/py-azureml-automl-core/package.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ class PyAzuremlAutomlCore(PythonPackage):
1414
homepage = "https://docs.microsoft.com/en-us/azure/machine-learning/service/"
1515
url = "https://pypi.io/packages/py3/a/azureml_automl_core/azureml_automl_core-1.11.0-py3-none-any.whl"
1616

17-
version(
18-
"1.23.0",
19-
sha256="1fa4a900856b15e1ec9a6bb949946ed0c873a5a54da3db592f03dbb46a117ceb",
20-
expand=False,
21-
)
17+
version("1.23.0", sha256="1fa4a900856b15e1ec9a6bb949946ed0c873a5a54da3db592f03dbb46a117ceb")
2218

2319
depends_on("python@3.5:3", type=("build", "run"))
2420

var/spack/repos/builtin/packages/py-azureml-core/package.py

+3-15
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,9 @@ class PyAzuremlCore(PythonPackage):
1717
homepage = "https://docs.microsoft.com/en-us/azure/machine-learning/service/"
1818
url = "https://pypi.io/packages/py3/a/azureml_core/azureml_core-1.11.0-py3-none-any.whl"
1919

20-
version(
21-
"1.23.0",
22-
sha256="0965d0741e39cdb95cff5880dbf1a55fdd87cd9fc316884f965668e6cc36e628",
23-
expand=False,
24-
)
25-
version(
26-
"1.11.0",
27-
sha256="df8a01b04bb156852480de0bdd78434ed84f386e1891752bdf887faeaa2ca417",
28-
expand=False,
29-
)
30-
version(
31-
"1.8.0",
32-
sha256="a0f2b0977f18fb7dcb88c314594a4a85c636a36be3d582be1cae25655fea6105",
33-
expand=False,
34-
)
20+
version("1.23.0", sha256="0965d0741e39cdb95cff5880dbf1a55fdd87cd9fc316884f965668e6cc36e628")
21+
version("1.11.0", sha256="df8a01b04bb156852480de0bdd78434ed84f386e1891752bdf887faeaa2ca417")
22+
version("1.8.0", sha256="a0f2b0977f18fb7dcb88c314594a4a85c636a36be3d582be1cae25655fea6105")
3523

3624
depends_on("python@3.5:3.8", type=("build", "run"))
3725
depends_on("py-pytz", type=("build", "run"))

var/spack/repos/builtin/packages/py-azureml-dataprep-native/package.py

-4
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,23 @@ class PyAzuremlDataprepNative(PythonPackage):
1717
version(
1818
"30.0.0-py3.9",
1919
sha256="eaf3fcd9f965e87b03fe89d7c6fe6abce53483a79afc963e4981061f4c250e85",
20-
expand=False,
2120
url="https://pypi.io/packages/cp39/a/azureml_dataprep_native/azureml_dataprep_native-30.0.0-cp39-cp39-macosx_10_9_x86_64.whl",
2221
)
2322
version(
2423
"30.0.0-py3.8",
2524
sha256="6772b638f9d03a041b17ce4343061f5d543019200904b9d361b2b2629c3595a7",
26-
expand=False,
2725
preferred=True,
2826
url="https://pypi.io/packages/cp38/a/azureml_dataprep_native/azureml_dataprep_native-30.0.0-cp38-cp38-macosx_10_9_x86_64.whl",
2927
)
3028
elif sys.platform.startswith("linux"):
3129
version(
3230
"30.0.0-py3.9",
3331
sha256="b8673136948f682c84d047feacbfee436df053cba4f386f31c4c3a245a4e3646",
34-
expand=False,
3532
url="https://pypi.io/packages/cp39/a/azureml_dataprep_native/azureml_dataprep_native-30.0.0-cp39-cp39-manylinux1_x86_64.whl",
3633
)
3734
version(
3835
"30.0.0-py3.8",
3936
sha256="d07cf20f22b14c98576e135bbad9bb8aaa3108941d2beaadf050b4238bc93a18",
40-
expand=False,
4137
preferred=True,
4238
url="https://pypi.io/packages/cp38/a/azureml_dataprep_native/azureml_dataprep_native-30.0.0-cp38-cp38-manylinux1_x86_64.whl",
4339
)

var/spack/repos/builtin/packages/py-azureml-dataprep-rslex/package.py

-8
Original file line numberDiff line numberDiff line change
@@ -20,54 +20,46 @@ class PyAzuremlDataprepRslex(PythonPackage):
2020
version(
2121
"1.9.0-py3.9",
2222
sha256="9bdaa31d129dac19ee20d5a3aad1726397e90d8d741b4f6de4554040800fefe8",
23-
expand=False,
2423
url="https://pypi.io/packages/cp39/a/azureml_dataprep_rslex/azureml_dataprep_rslex-1.9.0-cp39-cp39-macosx_10_9_x86_64.whl",
2524
)
2625
version(
2726
"1.9.0-py3.8",
2827
sha256="9b2e741ac1c53d3f7e6061d264feccf157d97e404c772933a176e6021014484e",
29-
expand=False,
3028
preferred=True,
3129
url="https://pypi.io/packages/cp38/a/azureml_dataprep_rslex/azureml_dataprep_rslex-1.9.0-cp38-cp38-macosx_10_9_x86_64.whl",
3230
)
3331

3432
version(
3533
"1.8.0-py3.9",
3634
sha256="677c25a7e23ec7f91d25aa596f382f7f3b6d60fbc3258bead2b2a6aa42f3a16d",
37-
expand=False,
3835
url="https://pypi.io/packages/cp39/a/azureml_dataprep_rslex/azureml_dataprep_rslex-1.8.0-cp39-cp39-macosx_10_9_x86_64.whl",
3936
)
4037
version(
4138
"1.8.0-py3.8",
4239
sha256="d7f2dec06296544b1707f5b01c6a4eaad744b4abfe9e8e89830b561c84d95a7a",
43-
expand=False,
4440
url="https://pypi.io/packages/cp38/a/azureml_dataprep_rslex/azureml_dataprep_rslex-1.8.0-cp38-cp38-macosx_10_9_x86_64.whl",
4541
)
4642
elif sys.platform.startswith("linux"):
4743
version(
4844
"1.9.0-py3.9",
4945
sha256="79d52bb427e3ca781a645c4f11f7a8e5e2c8f61e61bfc162b4062d8e47bcf3d6",
50-
expand=False,
5146
url="https://pypi.io/packages/cp39/a/azureml_dataprep_rslex/azureml_dataprep_rslex-1.9.0-cp39-cp39-manylinux1_x86_64.whl",
5247
)
5348
version(
5449
"1.9.0-py3.8",
5550
sha256="a52461103b45867dd919bab593bb6f2426c9b5f5a435081e82a3c57c54c3add6",
56-
expand=False,
5751
preferred=True,
5852
url="https://pypi.io/packages/cp38/a/azureml_dataprep_rslex/azureml_dataprep_rslex-1.9.0-cp38-cp38-manylinux1_x86_64.whl",
5953
)
6054

6155
version(
6256
"1.8.0-py3.9",
6357
sha256="e251a077669703ca117b157b225fbc20832169f913476cf79c01a5c6f8ff7a50",
64-
expand=False,
6558
url="https://pypi.io/packages/cp39/a/azureml_dataprep_rslex/azureml_dataprep_rslex-1.8.0-cp39-cp39-manylinux1_x86_64.whl",
6659
)
6760
version(
6861
"1.8.0-py3.8",
6962
sha256="2ebfa164f0933a5cec383cd27ba10d33861a73237ef481ada5a9a822bb55514a",
70-
expand=False,
7163
url="https://pypi.io/packages/cp38/a/azureml_dataprep_rslex/azureml_dataprep_rslex-1.8.0-cp38-cp38-manylinux1_x86_64.whl",
7264
)
7365

var/spack/repos/builtin/packages/py-azureml-dataprep/package.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,8 @@ class PyAzuremlDataprep(PythonPackage):
1313
homepage = "https://docs.microsoft.com/en-us/python/api/overview/azure/ml/?view=azure-ml-py"
1414
url = "https://pypi.io/packages/py3/a/azureml_dataprep/azureml_dataprep-2.0.2-py3-none-any.whl"
1515

16-
version(
17-
"2.11.0",
18-
sha256="755c0d7cfe228705aee7adc97813fb6d7d6ecb048b66f47c1fd5897f2709c3a2",
19-
expand=False,
20-
)
21-
version(
22-
"2.10.1",
23-
sha256="a36f807112ff1e64d21265b8e7f40154c93e3bead539e2a74c9d74200fd77c86",
24-
expand=False,
25-
)
16+
version("2.11.0", sha256="755c0d7cfe228705aee7adc97813fb6d7d6ecb048b66f47c1fd5897f2709c3a2")
17+
version("2.10.1", sha256="a36f807112ff1e64d21265b8e7f40154c93e3bead539e2a74c9d74200fd77c86")
2618

2719
variant("fuse", default=False, description="Build with FUSE support")
2820

var/spack/repos/builtin/packages/py-azureml-dataset-runtime/package.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ class PyAzuremlDatasetRuntime(PythonPackage):
1414
homepage = "https://docs.microsoft.com/en-us/azure/machine-learning/service/"
1515
url = "https://pypi.io/packages/py3/a/azureml-dataset-runtime/azureml_dataset_runtime-1.11.0.post1-py3-none-any.whl"
1616

17-
version(
18-
"1.23.0",
19-
sha256="96ca73d03ffedc0dd336d9383d2e17cf74548a89fc7ca4c201c599817c97bbc6",
20-
expand=False,
21-
)
17+
version("1.23.0", sha256="96ca73d03ffedc0dd336d9383d2e17cf74548a89fc7ca4c201c599817c97bbc6")
2218

2319
variant("fuse", default=False, description="Build with FUSE support")
2420

var/spack/repos/builtin/packages/py-azureml-pipeline-core/package.py

+3-15
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,9 @@ class PyAzuremlPipelineCore(PythonPackage):
1313
homepage = "https://docs.microsoft.com/en-us/azure/machine-learning/service/"
1414
url = "https://pypi.io/packages/py3/a/azureml_pipeline_core/azureml_pipeline_core-1.11.0-py3-none-any.whl"
1515

16-
version(
17-
"1.23.0",
18-
sha256="347e3e41559879611d53eeff5c05dd133db6fa537edcf2b9f70d91aad461df02",
19-
expand=False,
20-
)
21-
version(
22-
"1.11.0",
23-
sha256="98012195e3bba12bf42ac69179549038b3563b39e3dadab4f1d06407a00ad8b3",
24-
expand=False,
25-
)
26-
version(
27-
"1.8.0",
28-
sha256="24e1c57a57e75f9d74ea6f45fa4e93c1ee3114c8ed9029d538f9cc8e4f8945b2",
29-
expand=False,
30-
)
16+
version("1.23.0", sha256="347e3e41559879611d53eeff5c05dd133db6fa537edcf2b9f70d91aad461df02")
17+
version("1.11.0", sha256="98012195e3bba12bf42ac69179549038b3563b39e3dadab4f1d06407a00ad8b3")
18+
version("1.8.0", sha256="24e1c57a57e75f9d74ea6f45fa4e93c1ee3114c8ed9029d538f9cc8e4f8945b2")
3119

3220
depends_on("python@3.5:3", type=("build", "run"))
3321
depends_on("py-azureml-core@1.23.0:1.23", when="@1.23.0", type=("build", "run"))

var/spack/repos/builtin/packages/py-azureml-pipeline-steps/package.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ class PyAzuremlPipelineSteps(PythonPackage):
1313
homepage = "https://docs.microsoft.com/en-us/azure/machine-learning/service/"
1414
url = "https://pypi.io/packages/py3/a/azureml_pipeline_steps/azureml_pipeline_steps-1.11.0-py3-none-any.whl"
1515

16-
version(
17-
"1.23.0",
18-
sha256="72154c2f75624a1e7500b8e2239ae1354eeedf66d2cabb11e213b7eb80aedddb",
19-
expand=False,
20-
)
16+
version("1.23.0", sha256="72154c2f75624a1e7500b8e2239ae1354eeedf66d2cabb11e213b7eb80aedddb")
2117

2218
depends_on("python@3:", type=("build", "run"))
2319

var/spack/repos/builtin/packages/py-azureml-pipeline/package.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ class PyAzuremlPipeline(PythonPackage):
1616
"https://pypi.io/packages/py3/a/azureml_pipeline/azureml_pipeline-1.11.0-py3-none-any.whl"
1717
)
1818

19-
version(
20-
"1.23.0",
21-
sha256="ed0fae96771840d3ffd63d63df1b1eed2f50c3b8dbe7b672a4f1ba6e66d0a392",
22-
expand=False,
23-
)
19+
version("1.23.0", sha256="ed0fae96771840d3ffd63d63df1b1eed2f50c3b8dbe7b672a4f1ba6e66d0a392")
2420

2521
depends_on("python@3:", type=("build", "run"))
2622

var/spack/repos/builtin/packages/py-azureml-sdk/package.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ class PyAzuremlSdk(PythonPackage):
1515

1616
maintainers("adamjstewart")
1717

18-
version(
19-
"1.23.0",
20-
sha256="b9520f426831acb99fafa1ecd154b6bfd4f73fbf71e918d819f9db4a75438ab9",
21-
expand=False,
22-
)
18+
version("1.23.0", sha256="b9520f426831acb99fafa1ecd154b6bfd4f73fbf71e918d819f9db4a75438ab9")
2319

2420
# https://github.com/Azure/MachineLearningNotebooks/issues/1285
2521
depends_on("python@3.5:3.8", type=("build", "run"))

var/spack/repos/builtin/packages/py-azureml-telemetry/package.py

+3-15
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,9 @@ class PyAzuremlTelemetry(PythonPackage):
1414
homepage = "https://docs.microsoft.com/en-us/azure/machine-learning/service/"
1515
url = "https://pypi.io/packages/py3/a/azureml_telemetry/azureml_telemetry-1.11.0-py3-none-any.whl"
1616

17-
version(
18-
"1.23.0",
19-
sha256="68f9aac77e468db80e60f75d0843536082e2884ab251b6d3054dd623bd9c9e0d",
20-
expand=False,
21-
)
22-
version(
23-
"1.11.0",
24-
sha256="0d46c4a7bb8c0b188f1503504a6029384bc2237d82a131e7d1e9e89c3491b1fc",
25-
expand=False,
26-
)
27-
version(
28-
"1.8.0",
29-
sha256="de657efe9773bea0de76c432cbab34501ac28606fe1b380d6883562ebda3d804",
30-
expand=False,
31-
)
17+
version("1.23.0", sha256="68f9aac77e468db80e60f75d0843536082e2884ab251b6d3054dd623bd9c9e0d")
18+
version("1.11.0", sha256="0d46c4a7bb8c0b188f1503504a6029384bc2237d82a131e7d1e9e89c3491b1fc")
19+
version("1.8.0", sha256="de657efe9773bea0de76c432cbab34501ac28606fe1b380d6883562ebda3d804")
3220

3321
depends_on("python@3.5:3", type=("build", "run"))
3422
depends_on("py-applicationinsights", type=("build", "run"))

var/spack/repos/builtin/packages/py-azureml-train-automl-client/package.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ class PyAzuremlTrainAutomlClient(PythonPackage):
1515
homepage = "https://docs.microsoft.com/en-us/azure/machine-learning/service/"
1616
url = "https://pypi.io/packages/py3/a/azureml_train_automl_client/azureml_train_automl_client-1.11.0-py3-none-any.whl"
1717

18-
version(
19-
"1.23.0",
20-
sha256="ac5f1ce9b04b4e61e2e28e0fa8d2d8e47937a546f624d1cd3aa6bc4f9110ecbe",
21-
expand=False,
22-
)
18+
version("1.23.0", sha256="ac5f1ce9b04b4e61e2e28e0fa8d2d8e47937a546f624d1cd3aa6bc4f9110ecbe")
2319

2420
depends_on("python@3.5:3", type=("build", "run"))
2521

0 commit comments

Comments
 (0)