Skip to content

Commit 6c06eae

Browse files
authored
build gdbgui as python executable (pex) (#402)
1 parent d800c7d commit 6c06eae

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

.github/workflows/build_executable.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ jobs:
3636
nox --non-interactive --session build_executable_${{ matrix.buildname }}
3737
- name: Upload ${{ matrix.buildname }} executable
3838
# if: github.ref == 'refs/heads/master'
39-
uses: actions/upload-artifact@v1
39+
uses: actions/upload-artifact@v2
4040
with:
4141
name: gdbgui_${{ matrix.buildname }}
42-
path: ./executable/${{ matrix.buildname }}
42+
path: |
43+
./build/executable

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
This release is focused mostly on Python 3.9 compatibility and updating dependencies
66

77
- Support only Python 3.9 (though other Python versions may still work)
8+
- Build gdbgui as a [pex](https://pypi.org/project/pex/) executable.
9+
- 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.
810
- Use only the threading async model for flask-socketio. No longer support gevent or eventlet.
911
- [bugfix] Catch exception if gdb used in tty window crashes instead of gdbgui crashing along with it
1012
- Disable pagination in gdb tty by default. It can be turned back on with `set pagination off`.

docs/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,5 @@ gdbgui is distributed through
8585

8686
## Contact
8787

88+
https://chadsmith.dev
8889

make_executable.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@
1313
import logging
1414

1515
logging.basicConfig(level=logging.INFO)
16-
if platform.startswith("linux"):
17-
platform_dir = "linux"
18-
elif platform.startswith("darwin"):
19-
platform_dir = "mac"
20-
elif platform == "win32":
21-
platform_dir = "windows"
22-
else:
23-
raise Exception("Unknown platform")
2416

2517

2618
def write_spec_with_gdbgui_version_in_name(spec_path, binary_name):
@@ -92,7 +84,7 @@ def generate_md5(binary: Path, output_file: Path):
9284
def main():
9385
binary_name = "gdbgui_%s" % __version__
9486
spec_path = "gdbgui_pyinstaller.spec"
95-
distpath = (Path("executable") / platform_dir).resolve()
87+
distpath = Path("build/executable").resolve()
9688
extension = ".exe" if platform == "win32" else ""
9789
binary_path = Path(distpath) / f"{binary_name}{extension}"
9890

noxfile.py

+22
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pathlib import Path
33
from sys import platform
44

5+
import hashlib
56
import nox # type: ignore
67

78

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

166168

167169
@nox.session(reuse_venv=True)
@@ -183,3 +185,23 @@ def build_executable_windows(session):
183185
if not platform.startswith("win32"):
184186
raise Exception(f"Unexpected platform {platform}")
185187
session.notify("build_executable_current_platform")
188+
189+
190+
@nox.session(python=python)
191+
def build_pex(session):
192+
"""Builds a pex of gdbgui"""
193+
# NOTE: frontend must be built before running this
194+
session.install("pex==2.1.45")
195+
pex_path = Path("build/executable/gdbgui.pex")
196+
session.run(
197+
"pex",
198+
".",
199+
"-c",
200+
"gdbgui",
201+
"-o",
202+
str(pex_path),
203+
external=True,
204+
)
205+
checksum = hashlib.md5(pex_path.read_bytes()).hexdigest()
206+
with open(f"{pex_path}.md5", "w+") as f:
207+
f.write(checksum + "\n")

0 commit comments

Comments
 (0)