Skip to content

Commit a4829d9

Browse files
committed
upgrade setuptools
1 parent 1491b79 commit a4829d9

4 files changed

Lines changed: 19 additions & 20 deletions

File tree

.azure-pipelines/templates/azdev_setup.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ steps:
1414
# clone azure-cli
1515
git clone -q --single-branch -b dev https://github.com/Azure/azure-cli.git ../azure-cli
1616
python -m pip install -U pip
17-
pip install azdev
17+
pip install --trusted-host azurecliprod.blob.core.windows.net "https://azurecliprod.blob.core.windows.net/beta/azdev-0.2.3b1-py3-none-any.whl"
1818
azdev --version
1919
azdev setup -c $CLI_REPO_PATH -r $CLI_EXT_REPO_PATH --debug
20-
# Installing setuptools with a version higher than 70.0.0 will not generate metadata.json
21-
pip install setuptools==70.0.0
2220
pip list -v
2321
az --version
2422
displayName: 'azdev setup'

azure-pipelines.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,11 @@ jobs:
7676
displayName: 'Use Python 3.12'
7777
inputs:
7878
versionSpec: 3.12
79+
- template: .azure-pipelines/templates/azdev_setup.yml
7980
- bash: |
8081
#!/usr/bin/env bash
8182
set -ev
82-
pip install wheel==0.30.0 requests packaging setuptools
83+
pip install requests packaging setuptools
8384
export CI="ADO"
8485
python ./scripts/ci/test_index.py -v
8586
displayName: "Verify Extensions Index"
@@ -104,8 +105,6 @@ jobs:
104105
inputs:
105106
versionSpec: '$(python.version)'
106107
- template: .azure-pipelines/templates/azdev_setup.yml
107-
- bash: pip install wheel==0.30.0
108-
displayName: 'Install wheel==0.30.0'
109108
- bash: |
110109
#!/usr/bin/env bash
111110
set -ev

scripts/ci/test_index.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
import json
1515
import logging
1616
import os
17+
import re
1718
import shutil
1819
import tempfile
1920
import unittest
2021

2122
from packaging import version
2223
from util import SRC_PATH
23-
from wheel.install import WHEEL_INFO_RE
2424

2525
from util import get_ext_metadata, get_whl_from_url, get_index_data
2626

@@ -32,6 +32,14 @@
3232
logger.addHandler(ch)
3333

3434

35+
# copy from wheel==0.30.0
36+
WHEEL_INFO_RE = re.compile(
37+
r"""^(?P<namever>(?P<name>.+?)(-(?P<ver>\d.+?))?)
38+
((-(?P<build>\d.*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
39+
\.whl|\.dist-info)$""",
40+
re.VERBOSE).match
41+
42+
3543
def get_sha256sum(a_file):
3644
sha256 = hashlib.sha256()
3745
with open(a_file, 'rb') as f:
@@ -85,8 +93,6 @@ def test_extension_filenames(self):
8593
"Extension name mismatch in extensions['{}']. "
8694
"Found an extension in the list with name "
8795
"{}".format(ext_name, item['metadata']['name']))
88-
# Due to https://github.com/pypa/wheel/issues/235 we prevent whls built with 0.31.0 or greater.
89-
# 0.29.0, 0.30.0 are the two previous versions before that release.
9096
parsed_filename = WHEEL_INFO_RE(item['filename'])
9197
p = parsed_filename.groupdict()
9298
self.assertTrue(p.get('name'), "Can't get name for {}".format(item['filename']))
@@ -196,14 +202,13 @@ def test_metadata(self):
196202
else:
197203
raise ex
198204

199-
# Due to https://github.com/pypa/wheel/issues/195 we prevent whls built with 0.31.0 or greater.
200-
# 0.29.0, 0.30.0 are the two previous versions before that release.
201205
supported_generators = ['bdist_wheel (0.29.0)', 'bdist_wheel (0.30.0)']
202206
self.assertIn(metadata.get('generator'), supported_generators,
203207
"{}: 'generator' should be one of {}. "
204-
"Build the extension with a different version of the 'wheel' package "
205-
"(e.g. `pip install wheel==0.30.0`). "
206-
"This is due to https://github.com/pypa/wheel/issues/195".format(ext_name,
208+
"Please install the latest azdev."
209+
"(e.g. `pip install azdev==0.2.3b1 && `)."
210+
"And update the extension index with the latest azdev."
211+
"(e.g. `azdev extension update-index xxx.whl`).".format(ext_name,
207212
supported_generators))
208213
self.assertDictEqual(metadata, item['metadata'],
209214
"Metadata for {} in index doesn't match the expected of: \n"

scripts/ci/util.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import json
1111
import zipfile
1212

13+
from azdev.operations.extensions.metadata import pkginfo_to_dict
1314
from subprocess import check_output
1415

1516
logger = logging.getLogger(__name__)
@@ -53,8 +54,7 @@ def _get_azext_metadata(ext_dir):
5354

5455

5556
def get_ext_metadata(ext_dir, ext_file, ext_name):
56-
# Modification of https://github.com/Azure/azure-cli/blob/dev/src/azure-cli-core/azure/cli/core/extension.py#L89
57-
WHL_METADATA_FILENAME = 'metadata.json'
57+
generated_metadata = pkginfo_to_dict(ext_file)
5858
zip_ref = zipfile.ZipFile(ext_file, 'r')
5959
zip_ref.extractall(ext_dir)
6060
zip_ref.close()
@@ -71,10 +71,7 @@ def get_ext_metadata(ext_dir, ext_file, ext_name):
7171
for dist_info_dirname in dist_info_dirs:
7272
parsed_dist_info_dir = WHEEL_INFO_RE(dist_info_dirname)
7373
if parsed_dist_info_dir and parsed_dist_info_dir.groupdict().get('name') == ext_name.replace('-', '_'):
74-
whl_metadata_filepath = os.path.join(ext_dir, dist_info_dirname, WHL_METADATA_FILENAME)
75-
if os.path.isfile(whl_metadata_filepath):
76-
with open(whl_metadata_filepath) as f:
77-
metadata.update(json.load(f))
74+
metadata.update(generated_metadata)
7875
return metadata
7976

8077

0 commit comments

Comments
 (0)