Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F131481644
D34739.id118760.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
14 KB
Referenced Files
None
Subscribers
None
D34739.id118760.diff
View Options
Index: lang/python310/Makefile
===================================================================
--- lang/python310/Makefile
+++ lang/python310/Makefile
@@ -1,6 +1,6 @@
PORTNAME= python
DISTVERSION= ${PYTHON_DISTVERSION}
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= lang python
MASTER_SITES= PYTHON/ftp/python/${DISTVERSION:C/[a-z].*//}
PKGNAMESUFFIX= ${PYTHON_SUFFIX}
@@ -16,7 +16,7 @@
LIB_DEPENDS= libffi.so:devel/libffi
USES= compiler:c11 cpe ncurses pathfix pkgconfig \
- python:${PYTHON_DISTVERSION:R},env readline shebangfix ssl tar:xz
+ python:${PYTHON_DISTVERSION:R},env readline shebangfix ssl tar:xz trigger
PATHFIX_MAKEFILEIN= Makefile.pre.in
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
@@ -25,6 +25,7 @@
SHEBANG_FILES+= Lib/test/ziptestdata/exe_with_z64 \
Lib/test/ziptestdata/exe_with_zip \
Lib/test/ziptestdata/header.sh
+TRIGGERS= ${PYTHON_VERSION}
DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm
CONFIGURE_ARGS+= --enable-shared --without-ensurepip \
Index: lang/python310/files/python3.10.ucl.in
===================================================================
--- /dev/null
+++ lang/python310/files/python3.10.ucl.in
@@ -0,0 +1,64 @@
+path_glob: "%%PYTHON_SITELIBDIR%%/*"
+cleanup: {
+ type: lua
+ sandbox: false
+ script: <<EOS
+function cleanup(directory)
+ for _,d in ipairs(pkg.readdir(directory)) do
+ local full_path = directory .. "/" .. d
+ local stat = pkg.stat(full_path)
+ if stat["type"] == "dir" then
+ cleanup(full_path)
+ end
+ os.remove(full_path)
+ end
+ os.remove(directory)
+end
+
+cleanup("%%PYTHON_LIBDIR%%")
+EOS
+}
+
+trigger: {
+ type: lua
+ sandbox: false
+ script: <<EOS
+function cleanup(directory)
+ for _,d in ipairs(pkg.readdir(directory)) do
+ local full_path = directory .. "/" .. d
+ local stat = pkg.stat(full_path)
+ if stat["type"] == "dir" then
+ if (d ~= "__pycache__") then
+ cleanup(full_path)
+ else
+ for _,bytecode_file in ipairs(pkg.readdir(full_path)) do
+ local file_origin = string.gsub(bytecode_file, "[.]cpython[-]%%PYTHON_SUFFIX%%[.].*pyc", ".py")
+ if file_origin then
+ local origin_path = directory .. "/" .. file_origin
+ if (not pkg.stat(origin_path)) then
+ --print("===> removed stale bytecode " .. bytecode_file)
+ os.remove(full_path .. "/" .. bytecode_file)
+ end
+ end
+ end
+ end
+ local res = pkg.readdir(full_path)
+ -- to appease out-of-order execution in package building environments
+ if res == nil then
+ break
+ end
+ 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
+}
Index: lang/python311/Makefile
===================================================================
--- lang/python311/Makefile
+++ lang/python311/Makefile
@@ -1,6 +1,6 @@
PORTNAME= python
DISTVERSION= ${PYTHON_DISTVERSION}
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= lang python
MASTER_SITES= PYTHON/ftp/python/${DISTVERSION:C/[a-z].*//}
PKGNAMESUFFIX= ${PYTHON_SUFFIX}
@@ -16,7 +16,7 @@
LIB_DEPENDS= libffi.so:devel/libffi
USES= compiler:c11 cpe ncurses pathfix pkgconfig \
- python:${PYTHON_DISTVERSION:R},env readline shebangfix ssl tar:xz
+ python:${PYTHON_DISTVERSION:R},env readline shebangfix ssl tar:xz trigger
PATHFIX_MAKEFILEIN= Makefile.pre.in
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
@@ -25,6 +25,7 @@
SHEBANG_FILES+= Lib/test/ziptestdata/exe_with_z64 \
Lib/test/ziptestdata/exe_with_zip \
Lib/test/ziptestdata/header.sh
+TRIGGER= ${PYTHON_VERSION}
DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm
CONFIGURE_ARGS+= --enable-shared --without-ensurepip \
Index: lang/python311/files/python3.11.ucl.in
===================================================================
--- /dev/null
+++ lang/python311/files/python3.11.ucl.in
@@ -0,0 +1,64 @@
+path_glob: "%%PYTHON_SITELIBDIR%%/*"
+cleanup: {
+ type: lua
+ sandbox: false
+ script: <<EOS
+function cleanup(directory)
+ for _,d in ipairs(pkg.readdir(directory)) do
+ local full_path = directory .. "/" .. d
+ local stat = pkg.stat(full_path)
+ if stat["type"] == "dir" then
+ cleanup(full_path)
+ end
+ os.remove(full_path)
+ end
+ os.remove(directory)
+end
+
+cleanup("%%PYTHON_LIBDIR%%")
+EOS
+}
+
+trigger: {
+ type: lua
+ sandbox: false
+ script: <<EOS
+function cleanup(directory)
+ for _,d in ipairs(pkg.readdir(directory)) do
+ local full_path = directory .. "/" .. d
+ local stat = pkg.stat(full_path)
+ if stat["type"] == "dir" then
+ if (d ~= "__pycache__") then
+ cleanup(full_path)
+ else
+ for _,bytecode_file in ipairs(pkg.readdir(full_path)) do
+ local file_origin = string.gsub(bytecode_file, "[.]cpython[-]%%PYTHON_SUFFIX%%[.].*pyc", ".py")
+ if file_origin then
+ local origin_path = directory .. "/" .. file_origin
+ if (not pkg.stat(origin_path)) then
+ --print("===> removed stale bytecode " .. bytecode_file)
+ os.remove(full_path .. "/" .. bytecode_file)
+ end
+ end
+ end
+ end
+ local res = pkg.readdir(full_path)
+ -- to appease out-of-order execution in package building environments
+ if res == nil then
+ break
+ end
+ 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
+}
Index: lang/python37/Makefile
===================================================================
--- lang/python37/Makefile
+++ lang/python37/Makefile
@@ -20,12 +20,13 @@
libmpdec.so:math/mpdecimal
USES= cpe ncurses pathfix pkgconfig python:${PYTHON_DISTVERSION:R},env readline \
- shebangfix ssl tar:xz
+ 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
+TRIGGERS= ${PYTHON_VERSION}
DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm
CONFIGURE_ARGS+= --enable-shared --with-system-ffi --with-system-libmpdec --without-ensurepip
Index: lang/python37/files/python3.7.ucl.in
===================================================================
--- /dev/null
+++ lang/python37/files/python3.7.ucl.in
@@ -0,0 +1,66 @@
+path_glob: "%%PYTHON_SITELIBDIR%%/*"
+cleanup: {
+ type: lua
+ sandbox: false
+ script: <<EOS
+function cleanup(directory)
+ for _,d in ipairs(pkg.readdir(directory)) do
+ local full_path = directory .. "/" .. d
+ local stat = pkg.stat(full_path)
+ if stat["type"] == "dir" then
+ cleanup(full_path)
+ end
+ os.remove(full_path)
+ end
+ os.remove(directory)
+end
+
+cleanup("%%PYTHON_LIBDIR%%")
+EOS
+}
+
+trigger: {
+ type: lua
+ sandbox: false
+ script: <<EOS
+function cleanup(directory)
+ for _,d in ipairs(pkg.readdir(directory)) do
+ local full_path = directory .. "/" .. d
+ local stat = pkg.stat(full_path)
+ if stat["type"] == "dir" then
+ if (d ~= "__pycache__") then
+ cleanup(full_path)
+ else
+ for _,bytecode_file in ipairs(pkg.readdir(full_path)) do
+ local file_origin = string.gsub(bytecode_file, "[.]cpython[-]%%PYTHON_SUFFIX%%[.].*pyc", ".py")
+ if file_origin then
+ local origin_path = directory .. "/" .. file_origin
+ if (not pkg.stat(origin_path)) then
+ --print("===> removed stale bytecode " .. bytecode_file)
+ os.remove(full_path .. "/" .. bytecode_file)
+ end
+ end
+ end
+ end
+ local res = pkg.readdir(full_path)
+ -- to appease out-of-order execution in package building environments
+ if res == nil then
+ break
+ end
+ 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
+}
Index: lang/python38/Makefile
===================================================================
--- lang/python38/Makefile
+++ lang/python38/Makefile
@@ -1,6 +1,6 @@
PORTNAME= python
DISTVERSION= ${PYTHON_DISTVERSION}
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= lang python
MASTER_SITES= PYTHON/ftp/python/${DISTVERSION}
PKGNAMESUFFIX= ${PYTHON_SUFFIX}
@@ -16,7 +16,7 @@
LIB_DEPENDS= libffi.so:devel/libffi
USES= cpe ncurses pathfix pkgconfig python:${PYTHON_DISTVERSION:R},env readline \
- shebangfix ssl tar:xz
+ shebangfix ssl tar:xz trigger
PATHFIX_MAKEFILEIN= Makefile.pre.in
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
@@ -25,6 +25,7 @@
SHEBANG_FILES+= Lib/test/ziptestdata/exe_with_z64 \
Lib/test/ziptestdata/exe_with_zip \
Lib/test/ziptestdata/header.sh
+TRIGGERS= ${PYTHON_VERSION}
DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm
CONFIGURE_ARGS+= --enable-shared --without-ensurepip \
Index: lang/python38/files/python3.8.ucl.in
===================================================================
--- /dev/null
+++ lang/python38/files/python3.8.ucl.in
@@ -0,0 +1,66 @@
+path_glob: "%%PYTHON_SITELIBDIR%%/*"
+cleanup: {
+ type: lua
+ sandbox: false
+ script: <<EOS
+function cleanup(directory)
+ for _,d in ipairs(pkg.readdir(directory)) do
+ local full_path = directory .. "/" .. d
+ local stat = pkg.stat(full_path)
+ if stat["type"] == "dir" then
+ cleanup(full_path)
+ end
+ os.remove(full_path)
+ end
+ os.remove(directory)
+end
+
+cleanup("%%PYTHON_LIBDIR%%")
+EOS
+}
+
+trigger: {
+ type: lua
+ sandbox: false
+ script: <<EOS
+function cleanup(directory)
+ for _,d in ipairs(pkg.readdir(directory)) do
+ local full_path = directory .. "/" .. d
+ local stat = pkg.stat(full_path)
+ if stat["type"] == "dir" then
+ if (d ~= "__pycache__") then
+ cleanup(full_path)
+ else
+ for _,bytecode_file in ipairs(pkg.readdir(full_path)) do
+ local file_origin = string.gsub(bytecode_file, "[.]cpython[-]%%PYTHON_SUFFIX%%[.].*pyc", ".py")
+ if file_origin then
+ local origin_path = directory .. "/" .. file_origin
+ if (not pkg.stat(origin_path)) then
+ --print("===> removed stale bytecode " .. bytecode_file)
+ os.remove(full_path .. "/" .. bytecode_file)
+ end
+ end
+ end
+ end
+ local res = pkg.readdir(full_path)
+ -- to appease out-of-order execution in package building environments
+ if res == nil then
+ break
+ end
+ 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
+}
Index: lang/python39/Makefile
===================================================================
--- lang/python39/Makefile
+++ lang/python39/Makefile
@@ -1,6 +1,6 @@
PORTNAME= python
DISTVERSION= ${PYTHON_DISTVERSION}
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= lang python
MASTER_SITES= PYTHON/ftp/python/${DISTVERSION}
PKGNAMESUFFIX= ${PYTHON_SUFFIX}
@@ -16,7 +16,7 @@
LIB_DEPENDS= libffi.so:devel/libffi
USES= compiler:c11 cpe ncurses pathfix pkgconfig \
- python:${PYTHON_DISTVERSION:R},env readline shebangfix ssl tar:xz
+ python:${PYTHON_DISTVERSION:R},env readline shebangfix ssl tar:xz trigger
PATHFIX_MAKEFILEIN= Makefile.pre.in
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
@@ -25,6 +25,7 @@
SHEBANG_FILES+= Lib/test/ziptestdata/exe_with_z64 \
Lib/test/ziptestdata/exe_with_zip \
Lib/test/ziptestdata/header.sh
+TRIGGERS= ${PYTHON_VERSION}
DISABLED_EXTENSIONS= _sqlite3 _tkinter _gdbm
CONFIGURE_ARGS+= --enable-shared --without-ensurepip \
Index: lang/python39/files/python3.9.ucl.in
===================================================================
--- /dev/null
+++ lang/python39/files/python3.9.ucl.in
@@ -0,0 +1,62 @@
+path_glob: "%%PYTHON_SITELIBDIR%%/*"
+cleanup: {
+ type: lua
+ sandbox: false
+ script: <<EOS
+function cleanup(directory)
+ for _,d in ipairs(pkg.readdir(directory)) do
+ local full_path = directory .. "/" .. d
+ local stat = pkg.stat(full_path)
+ if stat["type"] == "dir" then
+ cleanup(full_path)
+ end
+ os.remove(full_path)
+ end
+ os.remove(directory)
+end
+
+cleanup("%%PYTHON_LIBDIR%%")
+EOS
+}
+
+trigger: {
+ type: lua
+ sandbox: false
+ script: <<EOS
+function cleanup(directory)
+ for _,d in ipairs(pkg.readdir(directory)) do
+ local full_path = directory .. "/" .. d
+ local stat = pkg.stat(full_path)
+ if stat["type"] == "dir" then
+ if (d ~= "__pycache__") then
+ cleanup(full_path)
+ else
+ for _,bytecode_file in ipairs(pkg.readdir(full_path)) do
+ local file_origin = string.gsub(bytecode_file, "[.]cpython[-]%%PYTHON_SUFFIX%%[.].*pyc", ".py")
+ if file_origin then
+ local origin_path = directory .. "/" .. file_origin
+ if (not pkg.stat(origin_path)) then
+ os.remove(full_path .. "/" .. bytecode_file)
+ end
+ end
+ end
+ end
+ local res = pkg.readdir(full_path)
+ -- to appease out-of-order execution in package building environments
+ if res == nil then
+ break
+ end
+ if #res == 0 then
+ 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
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 9, 11:53 AM (16 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23495482
Default Alt Text
D34739.id118760.diff (14 KB)
Attached To
Mode
D34739: lang/python: add bytecode trigger
Attached
Detach File
Event Timeline
Log In to Comment