Skip to content

Commit

Permalink
freeze requirements and update python version to build pex (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
cs01 authored Jun 22, 2022
1 parent 9be90ff commit 9138473
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_executable.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build native gdbgui executables
name: Build native gdbgui executables with pyinstaller and pex

on:
pull_request:
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ["3.10"]

steps:
- uses: actions/checkout@v2
Expand All @@ -39,7 +39,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ["3.10"]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gdbgui/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.15.0.1
0.15.1.0
5 changes: 2 additions & 3 deletions make_executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
32 changes: 18 additions & 14 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = ["tests", "lint", "docs"]
python = ["3.9"]
python = ["3.10"]

prettier_command = [
"npx",
Expand All @@ -22,7 +22,7 @@

doc_dependencies = [".", "mkdocs", "mkdocs-material"]
lint_dependencies = [
"black==21.12b0",
"black==22.3.0",
"vulture",
"flake8",
"mypy==0.782",
Expand Down Expand Up @@ -129,13 +129,15 @@ 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)
session.run("yarn", "build", external=True)
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)


Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
},
zip_safe=False,
install_requires=distutils.text_file.TextFile(
filename="./requirements.in"
filename="./requirements.txt"
).readlines(),
classifiers=[
"Intended Audience :: Developers",
Expand Down

1 comment on commit 9138473

@gpdzvapatsva
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am having a challenge getting thia to work on windows. could you please assist

Please sign in to comment.