Skip to content

Commit

Permalink
build gdbgui as python executable (pex) (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
cs01 authored Aug 30, 2021
1 parent d800c7d commit 6c06eae
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 11 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build_executable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jobs:
nox --non-interactive --session build_executable_${{ matrix.buildname }}
- name: Upload ${{ matrix.buildname }} executable
# if: github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v2
with:
name: gdbgui_${{ matrix.buildname }}
path: ./executable/${{ matrix.buildname }}
path: |
./build/executable
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
This release is focused mostly on Python 3.9 compatibility and updating dependencies

- Support only Python 3.9 (though other Python versions may still work)
- Build gdbgui as a [pex](https://pypi.org/project/pex/) executable.
- These are executable Python environments that are self-contained with the exception of requiring a specific Python version installed in the environment running the executable. The pex executables should have better compatibility than PyInstaller executables, which sometimes have missing shared libraries depending on the operating system.
- Use only the threading async model for flask-socketio. No longer support gevent or eventlet.
- [bugfix] Catch exception if gdb used in tty window crashes instead of gdbgui crashing along with it
- Disable pagination in gdb tty by default. It can be turned back on with `set pagination off`.
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,5 @@ gdbgui is distributed through

## Contact

https://chadsmith.dev
[email protected]
10 changes: 1 addition & 9 deletions make_executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
import logging

logging.basicConfig(level=logging.INFO)
if platform.startswith("linux"):
platform_dir = "linux"
elif platform.startswith("darwin"):
platform_dir = "mac"
elif platform == "win32":
platform_dir = "windows"
else:
raise Exception("Unknown platform")


def write_spec_with_gdbgui_version_in_name(spec_path, binary_name):
Expand Down Expand Up @@ -92,7 +84,7 @@ def generate_md5(binary: Path, output_file: Path):
def main():
binary_name = "gdbgui_%s" % __version__
spec_path = "gdbgui_pyinstaller.spec"
distpath = (Path("executable") / platform_dir).resolve()
distpath = Path("build/executable").resolve()
extension = ".exe" if platform == "win32" else ""
binary_path = Path(distpath) / f"{binary_name}{extension}"

Expand Down
22 changes: 22 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pathlib import Path
from sys import platform

import hashlib
import nox # type: ignore


Expand Down Expand Up @@ -162,6 +163,7 @@ def build_executable_current_platform(session):
session.run("yarn", "build", external=True)
session.install(".", "PyInstaller>=4.5, <4.6")
session.run("python", "make_executable.py")
session.notify("build_pex")


@nox.session(reuse_venv=True)
Expand All @@ -183,3 +185,23 @@ def build_executable_windows(session):
if not platform.startswith("win32"):
raise Exception(f"Unexpected platform {platform}")
session.notify("build_executable_current_platform")


@nox.session(python=python)
def build_pex(session):
"""Builds a pex of gdbgui"""
# NOTE: frontend must be built before running this
session.install("pex==2.1.45")
pex_path = Path("build/executable/gdbgui.pex")
session.run(
"pex",
".",
"-c",
"gdbgui",
"-o",
str(pex_path),
external=True,
)
checksum = hashlib.md5(pex_path.read_bytes()).hexdigest()
with open(f"{pex_path}.md5", "w+") as f:
f.write(checksum + "\n")

0 comments on commit 6c06eae

Please sign in to comment.