Skip to content

Commit dfe09a0

Browse files
committed
Fix installing setup dependencies on newer versions of pip
1 parent 581813a commit dfe09a0

File tree

3 files changed

+32
-22
lines changed

3 files changed

+32
-22
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "bugfix",
3+
"category": "bundled-installer",
4+
"description": "Fix installing setup dependencies on newer versions of pip"
5+
}

scripts/install

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def pip_install_packages(install_dir):
149149

150150
with cd(PACKAGES_DIR):
151151
run(
152-
'{} -m pip install {} --find-links file://{} {}'.format(
152+
'{} -m pip install {} --find-links {} {}'.format(
153153
python, INSTALL_ARGS, PACKAGES_DIR, cli_tarball
154154
)
155155
)
@@ -159,24 +159,17 @@ def _install_setup_deps(python, setup_package_dir):
159159
# Some packages declare `setup_requires`, which is a list of dependencies
160160
# to be used at setup time. These need to be installed before anything
161161
# else, and pip doesn't manage them. We have to manage this ourselves
162-
# so for now we're explicitly installing the one setup_requires package
163-
# we need. This comes from python-dateutils.
164-
setuptools_scm_tarball = _get_package_tarball(
165-
setup_package_dir, 'setuptools_scm'
166-
)
167-
run(
168-
(
169-
'{} -m pip install --no-binary :all: --no-cache-dir --no-index '
170-
'--find-links file://{} {}'
171-
).format(python, setup_package_dir, setuptools_scm_tarball)
172-
)
173-
wheel_tarball = _get_package_tarball(setup_package_dir, 'wheel')
174-
run(
175-
(
176-
'{} -m pip install --no-binary :all: --no-cache-dir --no-index '
177-
'--find-links file://{} {}'
178-
).format(python, setup_package_dir, wheel_tarball)
179-
)
162+
# so for now we're explicitly installing setuptools_scm which is needed for
163+
# python-dateutils. We're also now installing setuptools since its no
164+
# longer installed alongside pip for 3.12+.
165+
for package in ['setuptools-', 'wheel', 'setuptools_scm']:
166+
# these are actually wheels, but the bundle lookup logic is the same
167+
tarball = _get_package_tarball(setup_package_dir, package)
168+
run(
169+
'{} -m pip install {} --find-links {} {}'.format(
170+
python, INSTALL_ARGS, PACKAGES_DIR, tarball
171+
)
172+
)
180173

181174

182175
def create_symlink(real_location, symlink_name):

scripts/make-bundle

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ PINNED_RUNTIME_DEPS = [
3333
('colorama', '0.4.5'),
3434
]
3535
BUILDTIME_DEPS = [
36+
('setuptools', '75.3.2'), # 75.4 dropped 3.8 support
3637
('setuptools-scm', '3.3.3'),
37-
('wheel', '0.33.6'),
38+
('wheel', '0.45.1'), # 46.0 dropped 3.8 support
3839
]
3940
PIP_DOWNLOAD_ARGS = '--no-build-isolation --no-binary :all:'
4041

@@ -84,6 +85,16 @@ def download_package_tarballs(dirname, packages):
8485
))
8586

8687

88+
def download_package_wheels(dirname, packages):
89+
with cd(dirname):
90+
for package, package_version in packages:
91+
run(
92+
'%s -m pip download %s==%s --no-build-isolation '
93+
'--only-binary :all:'
94+
% (sys.executable, package, package_version)
95+
)
96+
97+
8798
def download_cli_deps(scratch_dir, packages):
8899
# pip download will always download a more recent version of a package
89100
# even if one exists locally. The list of packages supplied in `packages`
@@ -174,9 +185,10 @@ def main():
174185
# manually install them. We isolate them to a particular directory so we
175186
# can run the install before the things they're dependent on. We have to do
176187
# this because pip won't actually find them since it doesn't handle build
177-
# dependencies.
188+
# dependencies. We use wheels for this, to avoid bootstrapping setuptools
189+
# in 3.12+ where its no longer included by default.
178190
setup_dir = os.path.join(package_dir, 'setup')
179-
download_package_tarballs(
191+
download_package_wheels(
180192
setup_dir,
181193
packages=BUILDTIME_DEPS,
182194
)

0 commit comments

Comments
 (0)