From nobody Wed Feb 15 21:35:59 2023 X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PHBG76QPJz3rMg6; Wed, 15 Feb 2023 21:35:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PHBG766Z2z3MNk; Wed, 15 Feb 2023 21:35:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676496959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/VIi4hSQ4fkXpdbz9l57CmhaULuKUdB5HHG8248Uj7Y=; b=fmkKR/JU4go5AqhBoP5FCGr214MNqMHLY/ei5qN4hIrQ3DH/wW9XiPnqWtyn14h4hFXNE8 2/psVB5bw+Ad37Ky+STasec6HZJKL/GO5n++zQSbNgeMUXb9GmIx7X17lolLa+f9Nae5XN qnhreoabQuVKaIoeqSYE5yzH5HUrmIRqCHhX14wQjHN2v++OQ9Dv4tSRuzpdE0GWXIdnWM Z0Xri8xp49cUrC5LvU2ERgbGFQpNFANHrQ6mh9NRUqjFjASWcjgOQkkdZlA+42ow5cVbUB sKCd7qQdGr/VcvH5mLsYnLBJy7SC/ZcT+SZ3phEd5nrdNdR4y7wbBGf0qXZ80g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676496959; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/VIi4hSQ4fkXpdbz9l57CmhaULuKUdB5HHG8248Uj7Y=; b=AsME3bT4vdMKolMqQ36DplnhD1kljgBoN7jt6qu2OvnFzHzEynT83SdOqIsBQrsRrpH9eq el29vW0jYqWJ4+s9xVi0PnCQa8yImpw9jp293xpug3FWYzuxSHrwQmijPfCb/WNUvCU05H qjDYoFYzXPP1vEqUlQCq4+bm6TXatgRJCIOuVW4g/KUKeOM7C0YxYh3466u46nS8+CBZ8o NckVNWIn9yC6VcuCXr4hxaXD/Txx8EFXMJwt/B8nx3yDKdyHHbTw218nyyHQH3MMPPbQuP mwctC6qKA6NAUbRsqOrRWlntBPdfOUBZI9zSdTSNJ7KfN4+DzoCYpAOaZ3EdwQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676496959; a=rsa-sha256; cv=none; b=PVpTB0NCymXqDMkryLfbFgZGoIoUKfGy0Sol1fiuRQq2qtlyw5lA0tHz5tT78henNdFDU6 XYMqMtn6M7zMHGgkXSXgaw60Pc8Xc4zbJiQdDLYfkx4ixOHKS4YuOM7BGuMoikV5hjLzFR Q2DtZ7T5wV16AbbQeQlLTXGfHI/eIu3d+6Fy0ZZRsJ9b2zdRSQdygRIcuGnW92efBHZGld EVpcOOdYrIgTHJ5MyyhkxOmPRKqyyt422ChQKtmCz/gMVGGFGUpe8wxV+m1xGEsuk1KkEI 6odaevkQ1h5TxaGSbHijXWbOCj3VRSQfNwhXRdeiv6kc2UQx+INBcB1qqV/mbQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PHBG74s80zfst; Wed, 15 Feb 2023 21:35:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31FLZxec021963; Wed, 15 Feb 2023 21:35:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31FLZxEE021962; Wed, 15 Feb 2023 21:35:59 GMT (envelope-from git) Date: Wed, 15 Feb 2023 21:35:59 GMT Message-Id: <202302152135.31FLZxEE021962@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Charlie Li Subject: git: c17ddfbf66e2 - main - lang/python: add bytecode trigger List-Id: Commit messages for all branches of the ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-all@freebsd.org X-BeenThere: dev-commits-ports-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vishwin X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c17ddfbf66e2801ec620d49979aca3d7077d7002 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by vishwin: URL: https://cgit.FreeBSD.org/ports/commit/?id=c17ddfbf66e2801ec620d49979aca3d7077d7002 commit c17ddfbf66e2801ec620d49979aca3d7077d7002 Author: Charlie Li AuthorDate: 2023-02-15 20:57:06 +0000 Commit: Charlie Li CommitDate: 2023-02-15 21:35:07 +0000 lang/python: add bytecode trigger Facilitates compiling, writing and removing bytecode files (.pyc) in site-packages after all pkg transactions have been completed. Technical details: https://wiki.freebsd.org/Python/CompiledPackages Fixes reports of Python port builds as root failing on filesystem violations due to bytecode file writes where the port did not include them in the package. For those ports/packages that currently package bytecode, some checksum mismatches on those files may occur. This is harmless and will be rectified, in large as part of a USE_PYTHON=distutils overhaul to reduce churn. While here, implement a long-standing todo item of letting lang/python ports use python.mk bits. Not only does this obviate duplicate variables in each Makefile, but SUB_LIST (also added) is used for these triggers. Co-authored by: tcberner Approved by: tcberner (mentor) Differential Revision: https://reviews.freebsd.org/D34739 --- CHANGES | 8 +++++++ Mk/Uses/python.mk | 25 ++++++++++++++++---- UPDATING | 17 ++++++++++++++ lang/python310/Makefile | 11 ++++----- lang/python310/files/python3.10.ucl.in | 40 ++++++++++++++++++++++++++++++++ lang/python311/Makefile | 11 ++++----- lang/python311/files/python3.11.ucl.in | 40 ++++++++++++++++++++++++++++++++ lang/python37/Makefile | 10 ++++---- lang/python37/files/python3.7.ucl.in | 42 ++++++++++++++++++++++++++++++++++ lang/python38/Makefile | 10 ++++---- lang/python38/files/python3.8.ucl.in | 42 ++++++++++++++++++++++++++++++++++ lang/python39/Makefile | 11 ++++----- lang/python39/files/python3.9.ucl.in | 40 ++++++++++++++++++++++++++++++++ 13 files changed, 269 insertions(+), 38 deletions(-) diff --git a/CHANGES b/CHANGES index 2c65d5dbbe11..a8736d2217ea 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,14 @@ in the release notes and/or placed into UPDATING. All ports committers are allowed to commit to this file. +20230215: +AUTHOR: vishwin@FreeBSD.org + + USES=python now includes SUB_LIST entries to facilitate common + substitutions for python.mk variables other than in ${PLIST}. + They are the same as PLIST_SUB, except PYTHON_INCLUDEDIR, + PYTHON_LIBDIR and PYTHON_SITELIBDIR include ${PREFIX}. + 20230111: AUTHOR: vishwin@FreeBSD.org diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk index 4e98aa29603c..7017308e7c9c 100644 --- a/Mk/Uses/python.mk +++ b/Mk/Uses/python.mk @@ -257,17 +257,20 @@ # packages for different Python versions. # default: -py${PYTHON_SUFFIX} # -# Using USES=python also will add some useful entries to PLIST_SUB: +# Using USES=python also will add some useful entries to SUB_LIST and PLIST_SUB: # -# PYTHON_INCLUDEDIR=${PYTHONPREFIX_INCLUDEDIR:S;${PREFIX}/;;} -# PYTHON_LIBDIR=${PYTHONPREFIX_LIBDIR:S;${PREFIX}/;;} +# PYTHON_INCLUDEDIR=${PYTHONPREFIX_INCLUDEDIR} +# PYTHON_LIBDIR=${PYTHONPREFIX_LIBDIR} # PYTHON_PLATFORM=${PYTHON_PLATFORM} -# PYTHON_SITELIBDIR=${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;} +# PYTHON_SITELIBDIR=${PYTHONPREFIX_SITELIBDIR} # PYTHON_SUFFIX=${PYTHON_SUFFIX} # PYTHON_VER=${PYTHON_VER} # PYTHON_VERSION=${PYTHON_VERSION} # -# and PYTHON2 and PYTHON3 will be set according to the Python version: +# where PYTHON_INCLUDEDIR, PYTHON_LIBDIR and PYTHON_SITELIBDIR have their PREFIX +# stripped for PLIST_SUB. +# +# PYTHON2 and PYTHON3 will also be set according to the Python version: # # PYTHON2="" PYTHON3="@comment " for Python 2.x # PYTHON2="@comment " PYTHON3="" for Python 3.x @@ -785,6 +788,16 @@ ${_stage}_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR} PREFIX= ${PYTHONBASE} . endif +# Substitutions for SUB_FILES +SUB_LIST+= PYTHON_INCLUDEDIR=${PYTHONPREFIX_INCLUDEDIR} \ + PYTHON_LIBDIR=${PYTHONPREFIX_LIBDIR} \ + PYTHON_PLATFORM=${PYTHON_PLATFORM} \ + PYTHON_SITELIBDIR=${PYTHONPREFIX_SITELIBDIR} \ + PYTHON_SUFFIX=${PYTHON_SUFFIX} \ + PYTHON_EXT_SUFFIX=${PYTHON_EXT_SUFFIX} \ + PYTHON_VER=${PYTHON_VER} \ + PYTHON_VERSION=${PYTHON_VERSION} + # Substitutions for pkg-plist # Use a short form of the PYTHONPREFIX_*DIR variables; we don't need the # base directory in the plist file. @@ -797,8 +810,10 @@ PLIST_SUB+= PYTHON_INCLUDEDIR=${PYTHONPREFIX_INCLUDEDIR:S;${PREFIX}/;;} \ PYTHON_VER=${PYTHON_VER} \ PYTHON_VERSION=${PYTHON_VERSION} . if ${PYTHON_REL} < 30000 +SUB_LIST+= PYTHON2="" PYTHON3="@comment " PLIST_SUB+= PYTHON2="" PYTHON3="@comment " . else +SUB_LIST+= PYTHON2="@comment " PYTHON3="" PLIST_SUB+= PYTHON2="@comment " PYTHON3="" . endif diff --git a/UPDATING b/UPDATING index 9a4ea9c7a5ed..d3bd39a6dcb5 100644 --- a/UPDATING +++ b/UPDATING @@ -5,6 +5,23 @@ they are unavoidable. You should get into the habit of checking this file for changes each time you update your ports collection, before attempting any port upgrades. +20230215: + AFFECTS: users of python + AUTHOR: vishwin@FreeBSD.org + + A trigger has been added to the lang/python3* ports to compile, + write and remove bytecode files (.pyc) in site-packages after all + pkg transactions have been completed. pkg will no longer manage + such files directly, as they are meant to be generated after + installation. + + For those ports/packages that still package bytecode, some package + checksum mismatches on those files may occur. This is harmless + and will be rectified. + + Technical details available at: + https://wiki.freebsd.org/Python/CompiledPackages + 20230213: Affects: users of sysutils/nut* AUTHOR: cy@FreeBSD.org diff --git a/lang/python310/Makefile b/lang/python310/Makefile index 7e51ea43cce1..66974f6c5366 100644 --- a/lang/python310/Makefile +++ b/lang/python310/Makefile @@ -1,5 +1,6 @@ PORTNAME= python DISTVERSION= ${PYTHON_DISTVERSION} +PORTREVISION= 1 CATEGORIES= lang python MASTER_SITES= PYTHON/ftp/python/${DISTVERSION:C/[a-z].*//} PKGNAMESUFFIX= ${PYTHON_SUFFIX} @@ -14,8 +15,8 @@ LICENSE= PSFL LIB_DEPENDS= libffi.so:devel/libffi -USES= compiler:c11 cpe ncurses pathfix pkgconfig readline \ - shebangfix ssl tar:xz +USES= compiler:c11 cpe ncurses pathfix pkgconfig \ + python:${PYTHON_DISTVERSION:R},env readline shebangfix ssl tar:xz trigger PATHFIX_MAKEFILEIN= Makefile.pre.in USE_LDCONFIG= yes GNU_CONFIGURE= yes @@ -24,11 +25,7 @@ SHEBANG_FILES= Lib/*.py Lib/*/*.py Lib/*/*/*.py Lib/*/*/*/*.py SHEBANG_FILES+= Lib/test/ziptestdata/exe_with_z64 \ Lib/test/ziptestdata/exe_with_zip \ Lib/test/ziptestdata/header.sh - -# Duplicate python.mk variables. TODO: Let lang/python?? ports use python.mk bits. -PYTHON_VER= ${PYTHON_DISTVERSION:R} -PYTHON_VERSION= python${PYTHON_VER} -PYTHON_SUFFIX= ${PYTHON_VER:S/.//g} +TRIGGERS= ${PYTHON_VERSION} DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm CONFIGURE_ARGS+= --enable-shared --without-ensurepip \ diff --git a/lang/python310/files/python3.10.ucl.in b/lang/python310/files/python3.10.ucl.in new file mode 100644 index 000000000000..63d455839549 --- /dev/null +++ b/lang/python310/files/python3.10.ucl.in @@ -0,0 +1,40 @@ +path_glob: "%%PYTHON_SITELIBDIR%%/*" +trigger: { + type: lua + sandbox: false + script: <=> removed stale bytecode " .. bytecode_file) + os.remove(full_path .. "/" .. bytecode_file) + end + end + end + end + local res = pkg.readdir(full_path) + if #res == 0 then + --print(" >=> removed empty directory " .. full_path ) + os.remove(full_path) + end + end + end +end + +print(">=> Cleaning stale bytecode files...") +cleanup("%%PYTHON_SITELIBDIR%%") + +print(">=> Byte-compiling Python source files...") +pkg.exec({"%%PYTHON_VERSION%%", "-m", "compileall", "-q", "-o", "0", "-o", "1", "-o", "2", "%%PYTHON_SITELIBDIR%%"}) +EOS +} diff --git a/lang/python311/Makefile b/lang/python311/Makefile index 81b31ae90b5c..537d1c352706 100644 --- a/lang/python311/Makefile +++ b/lang/python311/Makefile @@ -1,5 +1,6 @@ PORTNAME= python DISTVERSION= ${PYTHON_DISTVERSION} +PORTREVISION= 1 CATEGORIES= lang python MASTER_SITES= PYTHON/ftp/python/${DISTVERSION:C/[a-z].*//} PKGNAMESUFFIX= ${PYTHON_SUFFIX} @@ -14,8 +15,8 @@ LICENSE= PSFL LIB_DEPENDS= libffi.so:devel/libffi -USES= compiler:c11 cpe ncurses pathfix pkgconfig readline \ - shebangfix ssl tar:xz +USES= compiler:c11 cpe ncurses pathfix pkgconfig \ + python:${PYTHON_DISTVERSION:R},env readline shebangfix ssl tar:xz trigger PATHFIX_MAKEFILEIN= Makefile.pre.in USE_LDCONFIG= yes GNU_CONFIGURE= yes @@ -24,11 +25,7 @@ SHEBANG_FILES= Lib/*.py Lib/*/*.py Lib/*/*/*.py Lib/*/*/*/*.py SHEBANG_FILES+= Lib/test/ziptestdata/exe_with_z64 \ Lib/test/ziptestdata/exe_with_zip \ Lib/test/ziptestdata/header.sh - -# Duplicate python.mk variables. TODO: Let lang/python?? ports use python.mk bits. -PYTHON_VER= ${PYTHON_DISTVERSION:R} -PYTHON_VERSION= python${PYTHON_VER} -PYTHON_SUFFIX= ${PYTHON_VER:S/.//g} +TRIGGERS= ${PYTHON_VERSION} DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm CONFIGURE_ARGS+= --enable-shared --without-ensurepip \ diff --git a/lang/python311/files/python3.11.ucl.in b/lang/python311/files/python3.11.ucl.in new file mode 100644 index 000000000000..63d455839549 --- /dev/null +++ b/lang/python311/files/python3.11.ucl.in @@ -0,0 +1,40 @@ +path_glob: "%%PYTHON_SITELIBDIR%%/*" +trigger: { + type: lua + sandbox: false + script: <=> removed stale bytecode " .. bytecode_file) + os.remove(full_path .. "/" .. bytecode_file) + end + end + end + end + local res = pkg.readdir(full_path) + if #res == 0 then + --print(" >=> removed empty directory " .. full_path ) + os.remove(full_path) + end + end + end +end + +print(">=> Cleaning stale bytecode files...") +cleanup("%%PYTHON_SITELIBDIR%%") + +print(">=> Byte-compiling Python source files...") +pkg.exec({"%%PYTHON_VERSION%%", "-m", "compileall", "-q", "-o", "0", "-o", "1", "-o", "2", "%%PYTHON_SITELIBDIR%%"}) +EOS +} diff --git a/lang/python37/Makefile b/lang/python37/Makefile index ba87a69cb89e..29abf7366ba1 100644 --- a/lang/python37/Makefile +++ b/lang/python37/Makefile @@ -1,5 +1,6 @@ PORTNAME= python DISTVERSION= ${PYTHON_DISTVERSION} +PORTREVISION= 1 CATEGORIES= lang python MASTER_SITES= PYTHON/ftp/python/${DISTVERSION} PKGNAMESUFFIX= ${PYTHON_SUFFIX} @@ -18,17 +19,14 @@ EXPIRATION_DATE= 2023-06-27 LIB_DEPENDS= libffi.so:devel/libffi \ libmpdec.so:math/mpdecimal -USES= cpe ncurses pathfix pkgconfig readline shebangfix ssl tar:xz +USES= cpe ncurses pathfix pkgconfig python:${PYTHON_DISTVERSION:R},env readline \ + shebangfix ssl tar:xz trigger PATHFIX_MAKEFILEIN= Makefile.pre.in USE_LDCONFIG= yes GNU_CONFIGURE= yes python_CMD= ${PREFIX}/bin/python${PYTHON_DISTVERSION:R} SHEBANG_FILES= Lib/*.py Lib/*/*.py Lib/*/*/*.py Lib/*/*/*/*.py - -# Duplicate python.mk variables. TODO: Let lang/python?? ports use python.mk bits. -PYTHON_VER= ${PYTHON_DISTVERSION:R} -PYTHON_VERSION= python${PYTHON_VER} -PYTHON_SUFFIX= ${PYTHON_VER:S/.//g} +TRIGGERS= ${PYTHON_VERSION} DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm CONFIGURE_ARGS+= --enable-shared --with-system-ffi --with-system-libmpdec --without-ensurepip diff --git a/lang/python37/files/python3.7.ucl.in b/lang/python37/files/python3.7.ucl.in new file mode 100644 index 000000000000..a9ebb18f9c27 --- /dev/null +++ b/lang/python37/files/python3.7.ucl.in @@ -0,0 +1,42 @@ +path_glob: "%%PYTHON_SITELIBDIR%%/*" +trigger: { + type: lua + sandbox: false + script: <=> removed stale bytecode " .. bytecode_file) + os.remove(full_path .. "/" .. bytecode_file) + end + end + end + end + local res = pkg.readdir(full_path) + if #res == 0 then + --print(" >=> removed empty directory " .. full_path ) + os.remove(full_path) + end + end + end +end + +print(">=> Cleaning stale bytecode files...") +cleanup("%%PYTHON_SITELIBDIR%%") + +print(">=> Byte-compiling Python source files...") +pkg.exec({"%%PYTHON_VERSION%%", "-m", "compileall", "-q", "%%PYTHON_SITELIBDIR%%"}) +pkg.exec({"%%PYTHON_VERSION%%", "-O", "-m", "compileall", "-q", "%%PYTHON_SITELIBDIR%%"}) +pkg.exec({"%%PYTHON_VERSION%%", "-OO", "-m", "compileall", "-q", "%%PYTHON_SITELIBDIR%%"}) +EOS +} diff --git a/lang/python38/Makefile b/lang/python38/Makefile index fd476d48aecf..07a565977f73 100644 --- a/lang/python38/Makefile +++ b/lang/python38/Makefile @@ -1,5 +1,6 @@ PORTNAME= python DISTVERSION= ${PYTHON_DISTVERSION} +PORTREVISION= 1 CATEGORIES= lang python MASTER_SITES= PYTHON/ftp/python/${DISTVERSION} PKGNAMESUFFIX= ${PYTHON_SUFFIX} @@ -14,7 +15,8 @@ LICENSE= PSFL LIB_DEPENDS= libffi.so:devel/libffi -USES= cpe ncurses pathfix pkgconfig readline shebangfix ssl tar:xz +USES= cpe ncurses pathfix pkgconfig python:${PYTHON_DISTVERSION:R},env readline \ + shebangfix ssl tar:xz trigger PATHFIX_MAKEFILEIN= Makefile.pre.in USE_LDCONFIG= yes GNU_CONFIGURE= yes @@ -23,11 +25,7 @@ SHEBANG_FILES= Lib/*.py Lib/*/*.py Lib/*/*/*.py Lib/*/*/*/*.py SHEBANG_FILES+= Lib/test/ziptestdata/exe_with_z64 \ Lib/test/ziptestdata/exe_with_zip \ Lib/test/ziptestdata/header.sh - -# Duplicate python.mk variables. TODO: Let lang/python?? ports use python.mk bits. -PYTHON_VER= ${PYTHON_DISTVERSION:R} -PYTHON_VERSION= python${PYTHON_VER} -PYTHON_SUFFIX= ${PYTHON_VER:S/.//g} +TRIGGERS= ${PYTHON_VERSION} DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm CONFIGURE_ARGS+= --enable-shared --without-ensurepip \ diff --git a/lang/python38/files/python3.8.ucl.in b/lang/python38/files/python3.8.ucl.in new file mode 100644 index 000000000000..a9ebb18f9c27 --- /dev/null +++ b/lang/python38/files/python3.8.ucl.in @@ -0,0 +1,42 @@ +path_glob: "%%PYTHON_SITELIBDIR%%/*" +trigger: { + type: lua + sandbox: false + script: <=> removed stale bytecode " .. bytecode_file) + os.remove(full_path .. "/" .. bytecode_file) + end + end + end + end + local res = pkg.readdir(full_path) + if #res == 0 then + --print(" >=> removed empty directory " .. full_path ) + os.remove(full_path) + end + end + end +end + +print(">=> Cleaning stale bytecode files...") +cleanup("%%PYTHON_SITELIBDIR%%") + +print(">=> Byte-compiling Python source files...") +pkg.exec({"%%PYTHON_VERSION%%", "-m", "compileall", "-q", "%%PYTHON_SITELIBDIR%%"}) +pkg.exec({"%%PYTHON_VERSION%%", "-O", "-m", "compileall", "-q", "%%PYTHON_SITELIBDIR%%"}) +pkg.exec({"%%PYTHON_VERSION%%", "-OO", "-m", "compileall", "-q", "%%PYTHON_SITELIBDIR%%"}) +EOS +} diff --git a/lang/python39/Makefile b/lang/python39/Makefile index 58d7f7372ab2..178b0bc8b070 100644 --- a/lang/python39/Makefile +++ b/lang/python39/Makefile @@ -1,5 +1,6 @@ PORTNAME= python DISTVERSION= ${PYTHON_DISTVERSION} +PORTREVISION= 1 CATEGORIES= lang python MASTER_SITES= PYTHON/ftp/python/${DISTVERSION} PKGNAMESUFFIX= ${PYTHON_SUFFIX} @@ -14,8 +15,8 @@ LICENSE= PSFL LIB_DEPENDS= libffi.so:devel/libffi -USES= compiler:c11 cpe ncurses pathfix pkgconfig readline \ - shebangfix ssl tar:xz +USES= compiler:c11 cpe ncurses pathfix pkgconfig \ + python:${PYTHON_DISTVERSION:R},env readline shebangfix ssl tar:xz trigger PATHFIX_MAKEFILEIN= Makefile.pre.in USE_LDCONFIG= yes GNU_CONFIGURE= yes @@ -24,11 +25,7 @@ SHEBANG_FILES= Lib/*.py Lib/*/*.py Lib/*/*/*.py Lib/*/*/*/*.py SHEBANG_FILES+= Lib/test/ziptestdata/exe_with_z64 \ Lib/test/ziptestdata/exe_with_zip \ Lib/test/ziptestdata/header.sh - -# Duplicate python.mk variables. TODO: Let lang/python?? ports use python.mk bits. -PYTHON_VER= ${PYTHON_DISTVERSION:R} -PYTHON_VERSION= python${PYTHON_VER} -PYTHON_SUFFIX= ${PYTHON_VER:S/.//g} +TRIGGERS= ${PYTHON_VERSION} DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm CONFIGURE_ARGS+= --enable-shared --without-ensurepip \ diff --git a/lang/python39/files/python3.9.ucl.in b/lang/python39/files/python3.9.ucl.in new file mode 100644 index 000000000000..63d455839549 --- /dev/null +++ b/lang/python39/files/python3.9.ucl.in @@ -0,0 +1,40 @@ +path_glob: "%%PYTHON_SITELIBDIR%%/*" +trigger: { + type: lua + sandbox: false + script: <=> removed stale bytecode " .. bytecode_file) + os.remove(full_path .. "/" .. bytecode_file) + end + end + end + end + local res = pkg.readdir(full_path) + if #res == 0 then + --print(" >=> removed empty directory " .. full_path ) + os.remove(full_path) + end + end + end +end + +print(">=> Cleaning stale bytecode files...") +cleanup("%%PYTHON_SITELIBDIR%%") + +print(">=> Byte-compiling Python source files...") +pkg.exec({"%%PYTHON_VERSION%%", "-m", "compileall", "-q", "-o", "0", "-o", "1", "-o", "2", "%%PYTHON_SITELIBDIR%%"}) +EOS +}