[PATCH 2 of 4] packaging: update the venv_py2 target to use recently vendored util modules

3 afișări
Accesați primul mesaj necitit

Matt Harbison

necitită,
25 apr. 2022, 17:05:2825.04.2022
– thg...@googlegroups.com
# HG changeset patch
# User Matt Harbison <matt_h...@yahoo.com>
# Date 1650411990 14400
# Tue Apr 19 19:46:30 2022 -0400
# Node ID ba3f28f0dacb1e6175c3019df61d1851c214747e
# Parent df3b276d4ec3a73a88b35111ad0f5ccc6400a91b
# EXP-Topic windows-py3-packaging
packaging: update the venv_py2 target to use recently vendored util modules

The new wix and py2exe modules need to use the recently vendored code (instead
of the current upstream code), which still downloads the WiX installer package.

Mostly a don't care at this point, but the py2 removal from upstream also broke
these scripts, so fix that up.

diff --git a/contrib/packaging/thgpackaging/cli.py b/contrib/packaging/thgpackaging/cli.py
--- a/contrib/packaging/thgpackaging/cli.py
+++ b/contrib/packaging/thgpackaging/cli.py
@@ -15,7 +15,9 @@
import sys

from . import (
+ util as thgutil,
venv,
+ venv_py2,
wix,
)

@@ -36,21 +38,10 @@
if output and not os.path.isabs(output):
raise Exception("--output arg must be an absolute path")

- pkg_path = pathlib.Path(hg) / 'contrib' / 'packaging'
- sys.path.insert(0, str(pkg_path))
-
- if not pkg_path.exists():
- raise Exception(
- "--hg arg must point to a Mercurial repository with packaging "
- "scripts"
- )
-
build_dir = SOURCE_DIR / "build"
python_exe = pathlib.Path(python)

- import hgpackaging.util as hgutil
-
- py_info = hgutil.python_exe_info(python_exe)
+ py_info = thgutil.python_exe_info(python_exe)

if not output:
version = str(py_info['version']).strip()
@@ -74,9 +65,6 @@
"--python arg must be Python 3.7 or later; or use venv_py2 instead"
)
else:
- # Delayed import to pick up sys.path modification
- from . import venv_py2
-
venv_py2.build_py2(
SOURCE_DIR,
pathlib.Path(hg),
diff --git a/contrib/packaging/thgpackaging/venv_py2.py b/contrib/packaging/thgpackaging/venv_py2.py
--- a/contrib/packaging/thgpackaging/venv_py2.py
+++ b/contrib/packaging/thgpackaging/venv_py2.py
@@ -14,15 +14,15 @@
import shutil
import subprocess

-from hgpackaging.downloads import (
+from .downloads import (
DOWNLOADS,
download_entry,
)
-from hgpackaging import (
- util as hgutil,
+from . import (
+ util as thgutil,
wix,
)
-from hgpackaging.util import (
+from .util import (
extract_tar_to_directory,
extract_zip_to_directory,
process_install_rules,
@@ -87,7 +87,7 @@

venv_bin, venv_pip, venv_python = _make_venv(python_exe, build_dir, output)

- py_info = hgutil.python_exe_info(python_exe)
+ py_info = thgutil.python_exe_info(python_exe)
vc_x64 = py_info['arch'] == '64bit'

if os.name == 'nt':
Răspundeți tuturor
Răspundeți autorului
Redirecționați
0 mesaje noi