mirror of
https://github.com/certbot/certbot.git
synced 2026-05-28 04:34:11 -04:00
Pin pynsist (#8749)
* Pin pynsist * Update dependencies * Set windows installer a proper python project * Optimize usage of the venvs * Add windows-installer when venv is set up * Fix call * Remove env marker
This commit is contained in:
parent
1ea588d504
commit
fea0b4e2e5
12 changed files with 86 additions and 36 deletions
|
|
@ -62,7 +62,13 @@ jobs:
|
|||
versionSpec: 3.8
|
||||
architecture: x86
|
||||
addToPath: true
|
||||
- script: python windows-installer/construct.py
|
||||
- script: |
|
||||
python -m venv venv
|
||||
venv\Scripts\python tools\pipstrap.py
|
||||
venv\Scripts\python tools\pip_install.py -e windows-installer
|
||||
displayName: Prepare Windows installer build environment
|
||||
- script: |
|
||||
venv\Scripts\construct-windows-installer
|
||||
displayName: Build Certbot installer
|
||||
- task: CopyFiles@2
|
||||
inputs:
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ certbot-nginx = {path = "../../certbot-nginx", extras = ["docs"]}
|
|||
certbot-apache = {path = "../../certbot-apache", extras = ["dev"]}
|
||||
certbot = {path = "../../certbot", extras = ["dev", "docs"]}
|
||||
acme = {path = "../../acme", extras = ["dev", "docs"]}
|
||||
windows-installer = {path = "../../windows-installer"}
|
||||
|
||||
# Extra dependencies
|
||||
# See https://github.com/certbot/certbot/issues/8425.
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ backcall==0.2.0
|
|||
bcrypt==3.2.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
beautifulsoup4==4.9.3; python_version >= "3.6" and python_version < "4.0"
|
||||
bleach==3.3.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0"
|
||||
boto3==1.17.37; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
botocore==1.20.37; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
boto3==1.17.42; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
botocore==1.20.42; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
cachecontrol==0.12.6; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0"
|
||||
cached-property==1.5.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
cachetools==4.2.1; python_version >= "3.5" and python_version < "4.0" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6")
|
||||
|
|
@ -40,7 +40,7 @@ decorator==4.4.2; python_version == "3.6" and python_full_version < "3.0.0" or p
|
|||
deprecated==1.2.12; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.4.0"
|
||||
distlib==0.3.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0"
|
||||
distro==1.5.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
dns-lexicon==3.5.5; python_version >= "3.6" and python_version < "4.0"
|
||||
dns-lexicon==3.5.6; python_version >= "3.6" and python_version < "4.0"
|
||||
dnspython==2.1.0; python_version >= "3.6"
|
||||
docker-compose==1.26.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
docker==4.2.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
|
|
@ -50,13 +50,13 @@ docutils==0.16; (python_version >= "2.7" and python_full_version < "3.0.0") or (
|
|||
execnet==1.8.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
filelock==3.0.12; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.6" and python_full_version >= "3.5.0" and python_version < "4.0"
|
||||
future==0.18.2; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "4.0" or python_version >= "3.6" and python_version < "4.0" and python_full_version >= "3.3.0"
|
||||
google-api-core==1.26.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
google-api-python-client==2.0.2; python_version >= "3.6"
|
||||
google-api-core==1.26.3; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
google-api-python-client==2.1.0; python_version >= "3.6"
|
||||
google-auth-httplib2==0.1.0; python_version >= "3.6"
|
||||
google-auth==1.28.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
googleapis-common-protos==1.53.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
html5lib==1.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0"
|
||||
httplib2==0.19.0; python_version >= "3.6"
|
||||
httplib2==0.19.1; python_version >= "3.6"
|
||||
idna==2.10; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "4.0" or python_full_version >= "3.5.0" and python_version >= "3.6" and python_version < "4.0"
|
||||
imagesize==1.2.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.4.0"
|
||||
importlib-metadata==1.7.0; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0") or python_version >= "3.6" and python_full_version >= "3.5.0" and python_version < "3.8" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0")
|
||||
|
|
@ -64,7 +64,7 @@ importlib-resources==5.1.2; python_version >= "3.6" and python_full_version < "3
|
|||
ipdb==0.13.7; python_version >= "3.6"
|
||||
ipython-genutils==0.2.0; python_version == "3.6"
|
||||
ipython==7.16.1; python_version == "3.6"
|
||||
ipython==7.21.0; python_version >= "3.7"
|
||||
ipython==7.22.0; python_version >= "3.7"
|
||||
isodate==0.6.0; python_version >= "3.6"
|
||||
isort==4.3.21; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.4.0"
|
||||
jedi==0.18.0
|
||||
|
|
@ -89,7 +89,7 @@ oauthlib==3.1.0; python_version >= "3.6" and python_full_version < "3.0.0" or py
|
|||
packaging==20.9; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.6.0"
|
||||
paramiko==2.7.2; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
parsedatetime==2.6; python_version >= "3.6"
|
||||
parso==0.8.1; python_version == "3.6"
|
||||
parso==0.8.2; python_version == "3.6"
|
||||
pastel==0.2.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0"
|
||||
pexpect==4.8.0
|
||||
pickleshare==0.7.5
|
||||
|
|
@ -111,6 +111,7 @@ pyjwt==1.7.1; python_version >= "3.6"
|
|||
pylev==1.3.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0"
|
||||
pylint==2.4.3; python_version >= "3.5"
|
||||
pynacl==1.4.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
pynsist==2.7; python_version >= "3.6"
|
||||
pyopenssl==20.0.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
pyparsing==2.4.7; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
pypiwin32==223; sys_platform == "win32" and python_version >= "3.6" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6")
|
||||
|
|
@ -123,13 +124,14 @@ pytest==3.2.5
|
|||
python-augeas==0.5.0
|
||||
python-dateutil==2.8.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6"
|
||||
python-digitalocean==1.16.0; python_version >= "3.6"
|
||||
python-dotenv==0.15.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
python-dotenv==0.16.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.6"
|
||||
pytz==2021.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.6.0"
|
||||
pywin32-ctypes==0.2.0; python_version >= "3.6" and python_version < "4.0" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0") and sys_platform == "win32"
|
||||
pywin32==300; sys_platform == "win32" and python_version >= "3.6" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6")
|
||||
pyyaml==5.4.1; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "4.0" or python_full_version >= "3.6.0" and python_version >= "3.6" and python_version < "4.0"
|
||||
readme-renderer==29.0; python_version >= "3.6"
|
||||
repoze.sphinx.autointerface==0.8; python_version >= "3.6"
|
||||
requests-download==0.1.2; python_version >= "3.6"
|
||||
requests-file==1.5.1; python_version >= "3.6" and python_version < "4.0"
|
||||
requests-oauthlib==1.3.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.4.0"
|
||||
requests-toolbelt==0.9.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0"
|
||||
|
|
@ -166,6 +168,7 @@ wcwidth==0.2.5; python_version == "3.6"
|
|||
webencodings==0.5.1; python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.5.0"
|
||||
websocket-client==0.58.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
wrapt==1.11.2; python_version >= "3.6" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_version >= "3.6" and python_full_version >= "3.4.0")
|
||||
yarg==0.1.9; python_version >= "3.6"
|
||||
zipp==3.4.1; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.7" or python_version >= "3.6" and python_full_version >= "3.5.0" and python_version < "3.7"
|
||||
zope.component==5.0.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
zope.event==4.5.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ REQUIREMENTS = [
|
|||
'-e certbot-ci',
|
||||
]
|
||||
|
||||
if sys.platform == 'win32':
|
||||
REQUIREMENTS.append('-e windows-installer')
|
||||
|
||||
VERSION_PATTERN = re.compile(r'^(\d+)\.(\d+).*$')
|
||||
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 179 KiB After Width: | Height: | Size: 179 KiB |
39
windows-installer/setup.py
Normal file
39
windows-installer/setup.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
from setuptools import find_packages
|
||||
from setuptools import setup
|
||||
|
||||
version = '1.0'
|
||||
|
||||
setup(
|
||||
name='windows-installer',
|
||||
version=version,
|
||||
description='Environment to build the Certbot Windows installer',
|
||||
url='https://github.com/letsencrypt/letsencrypt',
|
||||
author="Certbot Project",
|
||||
author_email='client-dev@letsencrypt.org',
|
||||
license='Apache License 2.0',
|
||||
python_requires='>=3.6',
|
||||
classifiers=[
|
||||
'Development Status :: 4 - Beta',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: Apache Software License',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
'Operating System :: Microsoft :: Windows',
|
||||
'Topic :: Software Development :: Build Tools',
|
||||
],
|
||||
|
||||
packages=find_packages(),
|
||||
include_package_data=True,
|
||||
install_requires=[
|
||||
'pynsist==2.7'
|
||||
],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'construct-windows-installer = windows_installer.construct:main',
|
||||
],
|
||||
},
|
||||
)
|
||||
0
windows-installer/windows_installer/__init__.py
Normal file
0
windows-installer/windows_installer/__init__.py
Normal file
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/env python3
|
||||
import contextlib
|
||||
import ctypes
|
||||
import os
|
||||
import re
|
||||
|
|
@ -7,7 +6,6 @@ import shutil
|
|||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
PYTHON_VERSION = (3, 8, 8)
|
||||
|
|
@ -16,6 +14,21 @@ NSIS_VERSION = '3.06.1'
|
|||
|
||||
|
||||
def main():
|
||||
if os.name != 'nt':
|
||||
raise RuntimeError('This script must be run under Windows.')
|
||||
|
||||
if ctypes.windll.shell32.IsUserAnAdmin() == 0:
|
||||
# Administrator privileges are required to properly install NSIS through Chocolatey
|
||||
raise RuntimeError('This script must be run with administrator privileges.')
|
||||
|
||||
if sys.version_info[:2] != PYTHON_VERSION[:2]:
|
||||
raise RuntimeError('This script must be run with Python {0}'
|
||||
.format('.'.join(str(item) for item in PYTHON_VERSION[0:2])))
|
||||
|
||||
if struct.calcsize('P') * 8 != PYTHON_BITNESS:
|
||||
raise RuntimeError('This script must be run with a {0} bit version of Python.'
|
||||
.format(PYTHON_BITNESS))
|
||||
|
||||
build_path, repo_path, venv_path, venv_python = _prepare_environment()
|
||||
|
||||
_copy_assets(build_path, repo_path)
|
||||
|
|
@ -24,14 +37,14 @@ def main():
|
|||
|
||||
_prepare_build_tools(venv_path, venv_python, repo_path)
|
||||
_compile_wheels(repo_path, build_path, venv_python)
|
||||
_build_installer(installer_cfg_path, venv_path)
|
||||
_build_installer(installer_cfg_path)
|
||||
|
||||
print('Done')
|
||||
|
||||
|
||||
def _build_installer(installer_cfg_path, venv_path):
|
||||
def _build_installer(installer_cfg_path):
|
||||
print('Build the installer')
|
||||
subprocess.check_call([os.path.join(venv_path, 'Scripts', 'pynsist.exe'), installer_cfg_path])
|
||||
subprocess.check_call([sys.executable, '-m', 'nsist', installer_cfg_path])
|
||||
|
||||
|
||||
def _compile_wheels(repo_path, build_path, venv_python):
|
||||
|
|
@ -72,7 +85,6 @@ def _prepare_build_tools(venv_path, venv_python, repo_path):
|
|||
print('Prepare build tools')
|
||||
subprocess.check_call([sys.executable, '-m', 'venv', venv_path])
|
||||
subprocess.check_call([venv_python, os.path.join(repo_path, 'tools', 'pipstrap.py')])
|
||||
subprocess.check_call([venv_python, os.path.join(repo_path, 'tools', 'pip_install.py'), 'pynsist'])
|
||||
subprocess.check_call(['choco', 'upgrade', '--allow-downgrade', '-y', 'nsis', '--version', NSIS_VERSION])
|
||||
|
||||
|
||||
|
|
@ -81,11 +93,11 @@ def _copy_assets(build_path, repo_path):
|
|||
if os.path.exists(build_path):
|
||||
os.rename(build_path, '{0}.{1}.bak'.format(build_path, int(time.time())))
|
||||
os.makedirs(build_path)
|
||||
shutil.copy(os.path.join(repo_path, 'windows-installer', 'certbot.ico'), build_path)
|
||||
shutil.copy(os.path.join(repo_path, 'windows-installer', 'run.bat'), build_path)
|
||||
shutil.copy(os.path.join(repo_path, 'windows-installer', 'template.nsi'), build_path)
|
||||
shutil.copy(os.path.join(repo_path, 'windows-installer', 'renew-up.ps1'), build_path)
|
||||
shutil.copy(os.path.join(repo_path, 'windows-installer', 'renew-down.ps1'), build_path)
|
||||
shutil.copy(os.path.join(repo_path, 'windows-installer', 'assets', 'certbot.ico'), build_path)
|
||||
shutil.copy(os.path.join(repo_path, 'windows-installer', 'assets', 'run.bat'), build_path)
|
||||
shutil.copy(os.path.join(repo_path, 'windows-installer', 'assets', 'template.nsi'), build_path)
|
||||
shutil.copy(os.path.join(repo_path, 'windows-installer', 'assets', 'renew-up.ps1'), build_path)
|
||||
shutil.copy(os.path.join(repo_path, 'windows-installer', 'assets', 'renew-down.ps1'), build_path)
|
||||
|
||||
|
||||
def _generate_pynsist_config(repo_path, build_path):
|
||||
|
|
@ -141,7 +153,7 @@ def _prepare_environment():
|
|||
raise RuntimeError('Error: Chocolatey (https://chocolatey.org/) needs '
|
||||
'to be installed to run this script.')
|
||||
script_path = os.path.realpath(__file__)
|
||||
repo_path = os.path.dirname(os.path.dirname(script_path))
|
||||
repo_path = os.path.dirname(os.path.dirname(os.path.dirname(script_path)))
|
||||
build_path = os.path.join(repo_path, 'windows-installer', 'build')
|
||||
venv_path = os.path.join(build_path, 'venv-config')
|
||||
venv_python = os.path.join(venv_path, 'Scripts', 'python.exe')
|
||||
|
|
@ -150,18 +162,4 @@ def _prepare_environment():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if os.name != 'nt':
|
||||
raise RuntimeError('This script must be run under Windows.')
|
||||
|
||||
if ctypes.windll.shell32.IsUserAnAdmin() == 0:
|
||||
# Administrator privileges are required to properly install NSIS through Chocolatey
|
||||
raise RuntimeError('This script must be run with administrator privileges.')
|
||||
|
||||
if sys.version_info[:2] != PYTHON_VERSION[:2]:
|
||||
raise RuntimeError('This script must be run with Python {0}'
|
||||
.format('.'.join(str(item) for item in PYTHON_VERSION[0:2])))
|
||||
|
||||
if struct.calcsize('P') * 8 != PYTHON_BITNESS:
|
||||
raise RuntimeError('This script must be run with a {0} bit version of Python.'
|
||||
.format(PYTHON_BITNESS))
|
||||
main()
|
||||
Loading…
Reference in a new issue