From 9138473156116340c2b1c0b72d35dba32b4a3bd6 Mon Sep 17 00:00:00 2001 From: Chad Smith Date: Tue, 21 Jun 2022 21:41:01 -0700 Subject: [PATCH] freeze requirements and update python version to build pex (#434) --- .github/workflows/build_executable.yml | 6 ++--- .github/workflows/tests.yml | 6 ++--- CHANGELOG.md | 1 + MANIFEST.in | 4 ++-- gdbgui/VERSION.txt | 2 +- make_executable.py | 5 ++-- noxfile.py | 32 +++++++++++++++----------- setup.py | 2 +- 8 files changed, 31 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build_executable.yml b/.github/workflows/build_executable.yml index 7f0bb34..716130a 100644 --- a/.github/workflows/build_executable.yml +++ b/.github/workflows/build_executable.yml @@ -1,4 +1,4 @@ -name: Build native gdbgui executables +name: Build native gdbgui executables with pyinstaller and pex on: pull_request: @@ -13,7 +13,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - python-version: [3.9] + python-version: ["3.10"] include: - os: ubuntu-latest buildname: linux @@ -33,7 +33,7 @@ jobs: python -m pip install nox - name: Compile ${{ matrix.buildname }} gdbgui executable run: | - nox --non-interactive --session build_executable_${{ matrix.buildname }} + nox --non-interactive --session build_executables_${{ matrix.buildname }} - name: Upload ${{ matrix.buildname }} executable # if: github.ref == 'refs/heads/master' uses: actions/upload-artifact@v2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ba95a89..5cf9e49 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.9] + python-version: ["3.10"] steps: - uses: actions/checkout@v2 @@ -39,7 +39,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: [3.9] + python-version: ["3.10"] steps: - uses: actions/checkout@v2 @@ -78,7 +78,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: "3.10" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/CHANGELOG.md b/CHANGELOG.md index 911c29a..5dcb2db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Compatibility with Werkzeug 2.1. Use the eventlet server instead of the Werkzeug development server. +- Use pinned requirements instead of abstract requirements to ensure reproducability of pip installs ## 0.15.0.1 diff --git a/MANIFEST.in b/MANIFEST.in index c07510d..d87b9bc 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,6 @@ include README.md include LICENSE -include requirements.in +include requirements.txt graft gdbgui # these files are built and must be included in distribution @@ -30,7 +30,7 @@ exclude jest.config.js exclude make_executable.py exclude mkdocs.yml exclude package.json -exclude requirements.txt +exclude requirements.in exclude tsconfig.json exclude tslint.json exclude webpack.config.js diff --git a/gdbgui/VERSION.txt b/gdbgui/VERSION.txt index 41db6aa..dd35abb 100644 --- a/gdbgui/VERSION.txt +++ b/gdbgui/VERSION.txt @@ -1 +1 @@ -0.15.0.1 +0.15.1.0 diff --git a/make_executable.py b/make_executable.py index 4d54815..d8a0cda 100644 --- a/make_executable.py +++ b/make_executable.py @@ -95,9 +95,8 @@ def main(): spec_path, "--distpath", distpath, - "--key", - "a5s1fe65aw41f54sa64v6b4ds98fhea98rhg4etj4et78ku4yu87mn", - ] + ], + check=True, ) verify(binary_path, __version__) generate_md5(binary_path, distpath / f"{binary_name}.md5") diff --git a/noxfile.py b/noxfile.py index 5541dc1..4414a8c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -8,7 +8,7 @@ import glob nox.options.reuse_existing_virtualenvs = True nox.options.sessions = ["tests", "lint", "docs"] -python = ["3.9"] +python = ["3.10"] prettier_command = [ "npx", @@ -22,7 +22,7 @@ prettier_command = [ doc_dependencies = [".", "mkdocs", "mkdocs-material"] lint_dependencies = [ - "black==21.12b0", + "black==22.3.0", "vulture", "flake8", "mypy==0.782", @@ -129,6 +129,7 @@ def serve(session): @nox.session(reuse_venv=True) def build(session): + """Build python distribution (sdist and wheels)""" session.install(*publish_deps) session.run("rm", "-rf", "dist", "build", external=True) session.run("yarn", external=True) @@ -136,6 +137,7 @@ def build(session): session.run("python", "setup.py", "--quiet", "sdist", "bdist_wheel") session.run("twine", "check", "dist/*") for built_package in glob.glob("dist/*"): + # ensure we can install the built distributions session.run("pip", "install", "--force-reinstall", built_package) @@ -160,49 +162,51 @@ def publish_docs(session): session.run("mkdocs", "gh-deploy") -@nox.session(reuse_venv=True) -def build_executable_current_platform(session): +@nox.session(reuse_venv=True, python="3.10") +def build_executables_current_platform(session): session.run("yarn", "install", external=True) session.run("yarn", "build", external=True) - session.install(".", "PyInstaller>=4.5, <4.6") + session.install(".", "PyInstaller==5.1") session.run("python", "make_executable.py") session.notify("build_pex") @nox.session(reuse_venv=True) -def build_executable_mac(session): +def build_executables_mac(session): if not platform.startswith("darwin"): raise Exception(f"Unexpected platform {platform}") - session.notify("build_executable_current_platform") + session.notify("build_executables_current_platform") @nox.session(reuse_venv=True) -def build_executable_linux(session): +def build_executables_linux(session): if not platform.startswith("linux"): raise Exception(f"Unexpected platform {platform}") - session.notify("build_executable_current_platform") + session.notify("build_executables_current_platform") @nox.session(reuse_venv=True) def build_executable_windows(session): if not platform.startswith("win32"): raise Exception(f"Unexpected platform {platform}") - session.notify("build_executable_current_platform") + session.notify("build_executables_current_platform") -@nox.session(python=python) +@nox.session def build_pex(session): """Builds a pex of gdbgui""" # NOTE: frontend must be built before running this - session.install("pex==2.1.45") + session.install("pex==2.1.93") pex_path = Path("build/executable/gdbgui.pex") session.run( "pex", ".", - "-c", + "--console-script", "gdbgui", - "-o", + "--output-file", str(pex_path), + "--sh-boot", + "--validate-entry-point", external=True, ) checksum = hashlib.md5(pex_path.read_bytes()).hexdigest() diff --git a/setup.py b/setup.py index 2f168b8..09c7511 100644 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ setup( }, zip_safe=False, install_requires=distutils.text_file.TextFile( - filename="./requirements.in" + filename="./requirements.txt" ).readlines(), classifiers=[ "Intended Audience :: Developers",