pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/misc/py-installer
Module Name: pkgsrc
Committed By: riastradh
Date: Thu Jan 23 19:31:09 UTC 2025
Modified Files:
pkgsrc/misc/py-installer: Makefile distinfo
Added Files:
pkgsrc/misc/py-installer/patches: patch-src_installer_____main____.py
patch-tests_test__main.py
Log Message:
misc/py-installer: Implement `--executable' option
https://github.com/pypa/installer/issue/257
https://github.com/pypa/installer/pull/258
This wille enable us to install Python scripts with #! lines for
LOCALBASE rather than TOOLBASE (or, from another perspective,
CROSS_LOCALBASE rather than LOCALBASE). For example, if you're doing
cross-builds in /home/user/pkg for /usr/pkg, the Python executable
running installer will be /home/usr/pkg/bin/python3.12 at build-time
but we need to bake /usr/pkg/bin/python3.12 into the build product.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 pkgsrc/misc/py-installer/Makefile
cvs rdiff -u -r1.1 -r1.2 pkgsrc/misc/py-installer/distinfo
cvs rdiff -u -r0 -r1.1 \
pkgsrc/misc/py-installer/patches/patch-src_installer_____main____.py \
pkgsrc/misc/py-installer/patches/patch-tests_test__main.py
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/misc/py-installer/Makefile
diff -u pkgsrc/misc/py-installer/Makefile:1.3 pkgsrc/misc/py-installer/Makefile:1.4
--- pkgsrc/misc/py-installer/Makefile:1.3 Wed Oct 25 22:21:38 2023
+++ pkgsrc/misc/py-installer/Makefile Thu Jan 23 19:31:09 2025
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.3 2023/10/25 22:21:38 wiz Exp $
+# $NetBSD: Makefile,v 1.4 2025/01/23 19:31:09 riastradh Exp $
DISTNAME= installer-0.7.0
PKGNAME= ${PYPKGPREFIX}-${DISTNAME}
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= misc python
MASTER_SITES= ${MASTER_SITE_PYPI:=i/installer/}
@@ -20,10 +20,17 @@ USE_LANGUAGES= # none
PYTHON_VERSIONS_INCOMPATIBLE= 27
INSTALL_ENV+= PYTHONPATH=${WRKSRC}/src
+TEST_ENV+= PYTHONPATH=${WRKSRC}/src
do-install:
cd ${WRKSRC} && ${SETENV} ${INSTALL_ENV} ${PYTHONBIN} -m installer --destdir ${DESTDIR} --prefix ${PREFIX} dist/*.whl
+# XXX Hack -- the patch phase leaves .orig files around which Python
+# dutifully picks up and installs because it doesn't use any explicit
+# lists of files or any patterns to exclude *.orig.
+post-install:
+ ${RM} -f ${DESTDIR}${PREFIX}/${PYSITELIB}/installer/*.orig
+
do-test:
cd ${WRKSRC} && ${SETENV} ${TEST_ENV} pytest-${PYVERSSUFFIX} tests
Index: pkgsrc/misc/py-installer/distinfo
diff -u pkgsrc/misc/py-installer/distinfo:1.1 pkgsrc/misc/py-installer/distinfo:1.2
--- pkgsrc/misc/py-installer/distinfo:1.1 Mon Apr 17 10:36:49 2023
+++ pkgsrc/misc/py-installer/distinfo Thu Jan 23 19:31:09 2025
@@ -1,5 +1,7 @@
-$NetBSD: distinfo,v 1.1 2023/04/17 10:36:49 adam Exp $
+$NetBSD: distinfo,v 1.2 2025/01/23 19:31:09 riastradh Exp $
BLAKE2s (installer-0.7.0.tar.gz) = 4187ebf5520c582b10d1c434bb3e41ef5eaf9a1c279740a6fc8f5c71f8b6944d
SHA512 (installer-0.7.0.tar.gz) = e89c2d28ca73d9c4291d645dda675fdcfcaba2e4f8765b9fa4a2f211e27711510f3d171b96a6b024c11808ba7f06b7b560a7cb31fafba815bd5c7396f26789f7
Size (installer-0.7.0.tar.gz) = 474349 bytes
+SHA1 (patch-src_installer_____main____.py) = b8660b711da4706eb0bfe2205b9a27492285ef69
+SHA1 (patch-tests_test__main.py) = 7128de09ad9d3cdab2969579892ca138332859ed
Added files:
Index: pkgsrc/misc/py-installer/patches/patch-src_installer_____main____.py
diff -u /dev/null pkgsrc/misc/py-installer/patches/patch-src_installer_____main____.py:1.1
--- /dev/null Thu Jan 23 19:31:09 2025
+++ pkgsrc/misc/py-installer/patches/patch-src_installer_____main____.py Thu Jan 23 19:31:09 2025
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_installer_____main____.py,v 1.1 2025/01/23 19:31:09 riastradh Exp $
+
+Add `--executable' option.
+https://github.com/pypa/installer/issues/257
+https://github.com/pypa/installer/pull/258
+
+--- src/installer/__main__.py.orig 2022-12-07 02:28:06.839389000 +0000
++++ src/installer/__main__.py
+@@ -31,6 +31,13 @@ def _get_main_parser() -> argparse.Argum
+ help="override prefix to install packages to",
+ )
+ parser.add_argument(
++ "--executable",
++ metavar="path",
++ default=sys.executable,
++ type=str,
++ help="#! executable to install scripts with (default=sys.executable)",
++ )
++ parser.add_argument(
+ "--compile-bytecode",
+ action="append",
+ metavar="level",
+@@ -86,7 +93,7 @@ def _main(cli_args: Sequence[str], progr
+ with WheelFile.open(args.wheel) as source:
+ destination = SchemeDictionaryDestination(
+ scheme_dict=_get_scheme_dict(source.distribution, prefix=args.prefix),
+- interpreter=sys.executable,
++ interpreter=args.executable,
+ script_kind=get_launcher_kind(),
+ bytecode_optimization_levels=bytecode_levels,
+ destdir=args.destdir,
Index: pkgsrc/misc/py-installer/patches/patch-tests_test__main.py
diff -u /dev/null pkgsrc/misc/py-installer/patches/patch-tests_test__main.py:1.1
--- /dev/null Thu Jan 23 19:31:09 2025
+++ pkgsrc/misc/py-installer/patches/patch-tests_test__main.py Thu Jan 23 19:31:09 2025
@@ -0,0 +1,45 @@
+$NetBSD: patch-tests_test__main.py,v 1.1 2025/01/23 19:31:09 riastradh Exp $
+
+Add `--executable' option.
+https://github.com/pypa/installer/issues/257
+https://github.com/pypa/installer/pull/258
+
+--- tests/test_main.py.orig 2025-01-20 07:30:09.049591508 +0000
++++ tests/test_main.py
+@@ -36,7 +36,18 @@ def test_main(fancy_wheel, tmp_path):
+ def test_main_prefix(fancy_wheel, tmp_path):
+ destdir = tmp_path / "dest"
+
+- main([str(fancy_wheel), "-d", str(destdir), "-p", "/foo"], "python -m installer")
++ main(
++ [
++ str(fancy_wheel),
++ "-d",
++ str(destdir),
++ "-p",
++ "/foo",
++ "--executable",
++ "/monty/python3.x",
++ ],
++ "python -m installer",
++ )
+
+ installed_py_files = list(destdir.rglob("*.py"))
+
+@@ -52,6 +63,16 @@ def test_main_prefix(fancy_wheel, tmp_pa
+ "__main__",
+ }
+
++ installed_scripts = destdir.rglob("bin/*")
++
++ for f in installed_scripts:
++ with f.open("rb") as fp:
++ shebang = fp.readline()
++ assert (
++ shebang == b"#!/monty/python3.x\n"
++ or shebang == b"#! /monty/python3.x\n"
++ )
++
+
+ def test_main_no_pyc(fancy_wheel, tmp_path):
+ destdir = tmp_path / "dest"
Home |
Main Index |
Thread Index |
Old Index