Page MenuHomeFreeBSD

D34739.id117014.diff
No OneTemporary

D34739.id117014.diff

Index: lang/python310/Makefile
===================================================================
--- lang/python310/Makefile
+++ 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}
@@ -15,7 +16,7 @@
LIB_DEPENDS= libffi.so:devel/libffi
USES= compiler:c11 cpe ncurses pathfix pkgconfig readline \
- shebangfix ssl tar:xz
+ shebangfix ssl tar:xz trigger
PATHFIX_MAKEFILEIN= Makefile.pre.in
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
@@ -24,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}
# Duplicate python.mk variables. TODO: Let lang/python?? ports use python.mk bits.
PYTHON_VER= ${PYTHON_DISTVERSION:R}
Index: lang/python310/files/python3.10.ucl.in
===================================================================
--- /dev/null
+++ lang/python310/files/python3.10.ucl.in
@@ -0,0 +1,40 @@
+path_glob: "%%PREFIX%%/lib/python3.10/site-packages/*"
+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[-]310[.].*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)
+ if #res == 0 then
+ print(" >=> removed empty directory " .. full_path )
+ os.remove(full_path)
+ end
+ end
+ end
+end
+
+print(">=> Cleaning stale bytecode files...")
+cleanup("%%PREFIX%%/lib/python3.10/site-packages")
+
+print(">=> Byte-compiling Python source files...")
+pkg.exec({"%%PREFIX%%/bin/python3.10", "-m", "compileall", "-o", "0", "-o", "1", "-o", "2", "%%PREFIX%%/lib/python3.10/site-packages"})
+EOS
+}
Index: lang/python311/Makefile
===================================================================
--- lang/python311/Makefile
+++ 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}
@@ -15,7 +16,7 @@
LIB_DEPENDS= libffi.so:devel/libffi
USES= compiler:c11 cpe ncurses pathfix pkgconfig readline \
- shebangfix ssl tar:xz
+ shebangfix ssl tar:xz trigger
PATHFIX_MAKEFILEIN= Makefile.pre.in
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
@@ -24,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}
# Duplicate python.mk variables. TODO: Let lang/python?? ports use python.mk bits.
PYTHON_VER= ${PYTHON_DISTVERSION:R}
Index: lang/python311/files/python3.11.ucl.in
===================================================================
--- /dev/null
+++ lang/python311/files/python3.11.ucl.in
@@ -0,0 +1,40 @@
+path_glob: "%%PREFIX%%/lib/python3.11/site-packages/*"
+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[-]311[.].*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)
+ if #res == 0 then
+ print(" >=> removed empty directory " .. full_path )
+ os.remove(full_path)
+ end
+ end
+ end
+end
+
+print(">=> Cleaning stale bytecode files...")
+cleanup("%%PREFIX%%/lib/python3.11/site-packages")
+
+print(">=> Byte-compiling Python source files...")
+pkg.exec({"%%PREFIX%%/bin/python3.11", "-m", "compileall", "-o", "0", "-o", "1", "-o", "2", "%%PREFIX%%/lib/python3.11/site-packages"})
+EOS
+}
Index: lang/python37/Makefile
===================================================================
--- lang/python37/Makefile
+++ 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,12 +19,13 @@
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 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
+TRIGGERS= ${PYTHON_VERSION}
# Duplicate python.mk variables. TODO: Let lang/python?? ports use python.mk bits.
PYTHON_VER= ${PYTHON_DISTVERSION:R}
Index: lang/python37/files/python3.7.ucl.in
===================================================================
--- /dev/null
+++ lang/python37/files/python3.7.ucl.in
@@ -0,0 +1,42 @@
+path_glob: "%%PREFIX%%/lib/python3.7/site-packages/*"
+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[-]37[.].*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)
+ if #res == 0 then
+ print(" >=> removed empty directory " .. full_path )
+ os.remove(full_path)
+ end
+ end
+ end
+end
+
+print(">=> Cleaning stale bytecode files...")
+cleanup("%%PREFIX%%/lib/python3.7/site-packages")
+
+print(">=> Byte-compiling Python source files...")
+pkg.exec({"%%PREFIX%%/bin/python3.7", "-m", "compileall", "%%PREFIX%%/lib/python3.7/site-packages"})
+pkg.exec({"%%PREFIX%%/bin/python3.7", "-O", "-m", "compileall", "%%PREFIX%%/lib/python3.7/site-packages"})
+pkg.exec({"%%PREFIX%%/bin/python3.7", "-OO", "-m", "compileall", "%%PREFIX%%/lib/python3.7/site-packages"})
+EOS
+}
Index: lang/python38/Makefile
===================================================================
--- lang/python38/Makefile
+++ 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,7 @@
LIB_DEPENDS= libffi.so:devel/libffi
-USES= cpe ncurses pathfix pkgconfig readline shebangfix ssl tar:xz
+USES= cpe ncurses pathfix pkgconfig readline shebangfix ssl tar:xz trigger
PATHFIX_MAKEFILEIN= Makefile.pre.in
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
@@ -23,6 +24,7 @@
SHEBANG_FILES+= Lib/test/ziptestdata/exe_with_z64 \
Lib/test/ziptestdata/exe_with_zip \
Lib/test/ziptestdata/header.sh
+TRIGGERS= ${PYTHON_VERSION}
# Duplicate python.mk variables. TODO: Let lang/python?? ports use python.mk bits.
PYTHON_VER= ${PYTHON_DISTVERSION:R}
Index: lang/python38/files/python3.8.ucl.in
===================================================================
--- /dev/null
+++ lang/python38/files/python3.8.ucl.in
@@ -0,0 +1,42 @@
+path_glob: "%%PREFIX%%/lib/python3.8/site-packages/*"
+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[-]38[.].*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)
+ if #res == 0 then
+ print(" >=> removed empty directory " .. full_path )
+ os.remove(full_path)
+ end
+ end
+ end
+end
+
+print(">=> Cleaning stale bytecode files...")
+cleanup("%%PREFIX%%/lib/python3.8/site-packages")
+
+print(">=> Byte-compiling Python source files...")
+pkg.exec({"%%PREFIX%%/bin/python3.8", "-m", "compileall", "%%PREFIX%%/lib/python3.8/site-packages"})
+pkg.exec({"%%PREFIX%%/bin/python3.8", "-O", "-m", "compileall", "%%PREFIX%%/lib/python3.8/site-packages"})
+pkg.exec({"%%PREFIX%%/bin/python3.8", "-OO", "-m", "compileall", "%%PREFIX%%/lib/python3.8/site-packages"})
+EOS
+}
Index: lang/python39/Makefile
===================================================================
--- lang/python39/Makefile
+++ 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}
@@ -15,7 +16,7 @@
LIB_DEPENDS= libffi.so:devel/libffi
USES= compiler:c11 cpe ncurses pathfix pkgconfig readline \
- shebangfix ssl tar:xz
+ shebangfix ssl tar:xz trigger
PATHFIX_MAKEFILEIN= Makefile.pre.in
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
@@ -24,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}
# Duplicate python.mk variables. TODO: Let lang/python?? ports use python.mk bits.
PYTHON_VER= ${PYTHON_DISTVERSION:R}
Index: lang/python39/files/python3.9.ucl.in
===================================================================
--- /dev/null
+++ lang/python39/files/python3.9.ucl.in
@@ -0,0 +1,40 @@
+path_glob: "%%PREFIX%%/lib/python3.9/site-packages/*"
+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[-]39[.].*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)
+ if #res == 0 then
+ print(" >=> removed empty directory " .. full_path )
+ os.remove(full_path)
+ end
+ end
+ end
+end
+
+print(">=> Cleaning stale bytecode files...")
+cleanup("%%PREFIX%%/lib/python3.9/site-packages")
+
+print(">=> Byte-compiling Python source files...")
+pkg.exec({"%%PREFIX%%/bin/python3.9", "-m", "compileall", "-o", "0", "-o", "1", "-o", "2", "%%PREFIX%%/lib/python3.9/site-packages"})
+EOS
+}

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 16, 6:09 AM (15 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29757194
Default Alt Text
D34739.id117014.diff (12 KB)

Event Timeline