simplify pywin32 pinning

This commit is contained in:
Brad Warren 2021-03-24 10:33:38 -07:00
parent b3ed6d1607
commit 8c71c847a2
2 changed files with 7 additions and 22 deletions

View file

@ -59,7 +59,7 @@ install_requires = [
# However environment markers are supported only with setuptools >= 36.2.
# So this dependency is not added for old Linux distributions with old setuptools,
# in order to allow these systems to build certbot from sources.
pywin32_req = 'pywin32>=300' # do not forget to edit pywin32 dependency accordingly in windows-installer/construct.py
pywin32_req = 'pywin32>=300'
setuptools_known_environment_markers = (LooseVersion(setuptools_version) >= LooseVersion('36.2'))
if setuptools_known_environment_markers:
install_requires.append(pywin32_req + " ; sys_platform == 'win32'")

View file

@ -12,7 +12,6 @@ import time
PYTHON_VERSION = (3, 8, 8)
PYTHON_BITNESS = 32
PYWIN32_VERSION = 300 # do not forget to edit pywin32 dependency accordingly in setup.py
NSIS_VERSION = '3.06.1'
@ -46,12 +45,12 @@ def _compile_wheels(repo_path, build_path, venv_python):
# certbot_packages.extend([name for name in os.listdir(repo_path) if name.startswith('certbot-dns-')])
wheels_project = [os.path.join(repo_path, package) for package in certbot_packages]
with _prepare_constraints(repo_path) as constraints_file_path:
env = os.environ.copy()
env['PIP_CONSTRAINT'] = constraints_file_path
command = [venv_python, '-m', 'pip', 'wheel', '-w', wheels_path]
command.extend(wheels_project)
subprocess.check_call(command, env=env)
constraints_file_path = os.path.join(repo_path, 'tools', 'requirements.txt')
env = os.environ.copy()
env['PIP_CONSTRAINT'] = constraints_file_path
command = [venv_python, '-m', 'pip', 'wheel', '-w', wheels_path]
command.extend(wheels_project)
subprocess.check_call(command, env=env)
# Cryptography uses now a unique wheel name "cryptography-VERSION-cpXX-abi3-win32.whl where
# cpXX is the lowest supported version of Python (eg. cp36 says that the wheel is compatible
@ -77,20 +76,6 @@ def _prepare_build_tools(venv_path, venv_python, repo_path):
subprocess.check_call(['choco', 'upgrade', '--allow-downgrade', '-y', 'nsis', '--version', NSIS_VERSION])
@contextlib.contextmanager
def _prepare_constraints(repo_path):
reqs = os.path.join(repo_path, 'tools', 'requirements.txt')
workdir = tempfile.mkdtemp()
try:
constraints_file_path = os.path.join(workdir, 'constraints.txt')
shutil.copy(reqs, constraints_file_path)
with open(constraints_file_path, 'a') as file_h:
file_h.write('pywin32=={0}'.format(PYWIN32_VERSION))
yield constraints_file_path
finally:
shutil.rmtree(workdir)
def _copy_assets(build_path, repo_path):
print('Copy assets')
if os.path.exists(build_path):