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: <=> 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: <=> 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: <=> 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: <=> 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: <=> 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 +}