| |
@@ -17,7 +17,7 @@
|
| |
%global prerel rc1
|
| |
%global upstream_version %{general_version}%{?prerel}
|
| |
Version: %{general_version}%{?prerel:~%{prerel}}
|
| |
- Release: 2%{?dist}
|
| |
+ Release: 3%{?dist}
|
| |
License: Python
|
| |
|
| |
|
| |
@@ -463,6 +463,10 @@
|
| |
Provides: bundled(python3dist(setuptools)) = %{setuptools_version}
|
| |
%endif
|
| |
|
| |
+ Recommends: %{pkgname}-libs-bytecode-opt-0%{?_isa} = %{version}-%{release}
|
| |
+ Suggests: %{pkgname}-libs-bytecode-opt-1%{?_isa} = %{version}-%{release}
|
| |
+ Suggests: %{pkgname}-libs-bytecode-opt-2%{?_isa} = %{version}-%{release}
|
| |
+
|
| |
# There are files in the standard library that have python shebang.
|
| |
# We've filtered the automatic requirement out so libs are installable without
|
| |
# the main package. This however makes it pulled in by default.
|
| |
@@ -493,6 +497,33 @@
|
| |
a scripting language, and by the main "%{exename}" executable
|
| |
|
| |
|
| |
+ %package -n %{pkgname}-libs-bytecode-opt-0
|
| |
+ Summary: Python runtime libraries compiled bytecode cache (without optimizations)
|
| |
+ Requires: %{pkgname}-libs%{?_isa} = %{version}-%{release}
|
| |
+
|
| |
+ %description -n %{pkgname}-libs-bytecode-opt-0
|
| |
+ This package contains the non-optimized bytecode cache files for the
|
| |
+ %{pkgname}-libs package.
|
| |
+
|
| |
+
|
| |
+ %package -n %{pkgname}-libs-bytecode-opt-1
|
| |
+ Summary: Python runtime libraries compiled bytecode cache (optimization level 1)
|
| |
+ Requires: %{pkgname}-libs%{?_isa} = %{version}-%{release}
|
| |
+
|
| |
+ %description -n %{pkgname}-libs-bytecode-opt-1
|
| |
+ This package contains the optimized (level 1) bytecode cache files for the
|
| |
+ %{pkgname}-libs package.
|
| |
+
|
| |
+
|
| |
+ %package -n %{pkgname}-libs-bytecode-opt-2
|
| |
+ Summary: Python runtime libraries compiled bytecode cache (optimization level 2)
|
| |
+ Requires: %{pkgname}-libs%{?_isa} = %{version}-%{release}
|
| |
+
|
| |
+ %description -n %{pkgname}-libs-bytecode-opt-2
|
| |
+ This package contains the optimized (level 2) bytecode cache files for the
|
| |
+ %{pkgname}-libs package.
|
| |
+
|
| |
+
|
| |
%package -n %{pkgname}-devel
|
| |
Summary: Libraries and header files needed for Python development
|
| |
Requires: %{pkgname} = %{version}-%{release}
|
| |
@@ -1059,6 +1090,12 @@
|
| |
rm ${directory}/{__pycache__/${module}.cpython-%{pyshortver}.opt-?.pyc,${module}.py}
|
| |
done
|
| |
|
| |
+ %global noclean_pycs_marker %{_localstatedir}/lib/rpm-state/%{name}-noclean-pycs
|
| |
+ %if %{without flatpackage}
|
| |
+ mkdir -p $(dirname %{buildroot}%{noclean_pycs_marker})
|
| |
+ echo "# intentionally empty" > %{buildroot}%{noclean_pycs_marker}
|
| |
+ %endif
|
| |
+
|
| |
# ======================================================
|
| |
# Checks for packaging issues
|
| |
# ======================================================
|
| |
@@ -1146,6 +1183,108 @@
|
| |
%endif # with tests
|
| |
|
| |
|
| |
+ # The list of directories containing pure Python modules in the python-libs package
|
| |
+ %global module_dirs %{expand:
|
| |
+ %{pylibdir}
|
| |
+ %{pylibdir}/asyncio
|
| |
+ %{pylibdir}/collections
|
| |
+ %{pylibdir}/concurrent
|
| |
+ %{pylibdir}/concurrent/futures
|
| |
+ %{pylibdir}/ctypes
|
| |
+ %{pylibdir}/ctypes/macholib
|
| |
+ %{pylibdir}/curses
|
| |
+ %{pylibdir}/dbm
|
| |
+ %{pylibdir}/distutils
|
| |
+ %{pylibdir}/distutils/command
|
| |
+ %{pylibdir}/email
|
| |
+ %{pylibdir}/email/mime
|
| |
+ %{pylibdir}/encodings
|
| |
+ %{pylibdir}/ensurepip
|
| |
+ %{?with_rpmwheels:%exclude }%{pylibdir}/ensurepip/_bundled
|
| |
+ %{pylibdir}/html
|
| |
+ %{pylibdir}/http
|
| |
+ %{pylibdir}/importlib
|
| |
+ %{pylibdir}/json
|
| |
+ %{pylibdir}/lib2to3
|
| |
+ %{pylibdir}/lib2to3/fixes
|
| |
+ %{pylibdir}/lib2to3/pgen2
|
| |
+ %{pylibdir}/logging
|
| |
+ %{pylibdir}/multiprocessing
|
| |
+ %{pylibdir}/multiprocessing/dummy
|
| |
+ %{pylibdir}/pydoc_data
|
| |
+ %{pylibdir}/sqlite3
|
| |
+ %{pylibdir}/unittest
|
| |
+ %{pylibdir}/urllib
|
| |
+ %{pylibdir}/venv
|
| |
+ %{pylibdir}/wsgiref
|
| |
+ %{pylibdir}/xml
|
| |
+ %{pylibdir}/xml/dom
|
| |
+ %{pylibdir}/xml/etree
|
| |
+ %{pylibdir}/xml/parsers
|
| |
+ %{pylibdir}/xml/sax
|
| |
+ %{pylibdir}/xmlrpc
|
| |
+ %{pylibdir}/zoneinfo
|
| |
+ }
|
| |
+
|
| |
+ %define list_module_dirs() %{lua:
|
| |
+ local module_dirs = rpm.expand("%module_dirs")
|
| |
+ local bytecode_suffixes = rpm.expand("%bytecode_suffixes")
|
| |
+ local ghost = ""
|
| |
+ if rpm.expand("%{without flatpackage}") == "1" then
|
| |
+ ghost = "%ghost "
|
| |
+ end
|
| |
+ for module_dir in module_dirs:gmatch('[^\\n]+') do
|
| |
+ if module_dir:find('^%%exclude%s') then
|
| |
+ print(module_dir .. "\\n")
|
| |
+ else
|
| |
+ print("%dir " .. module_dir .. "\\n")
|
| |
+ print("%dir " .. module_dir .. "/__pycache__\\n")
|
| |
+ print(module_dir .. "/*.py\\n")
|
| |
+ print(ghost .. module_dir .. "/__pycache__/*" .. bytecode_suffixes .. "\\n")
|
| |
+ end
|
| |
+ end
|
| |
+ }
|
| |
+
|
| |
+ %define list_bytecode_cached() %{lua:
|
| |
+ local module_dirs = rpm.expand("%module_dirs")
|
| |
+ local opt = rpm.expand("%{?1}")
|
| |
+ local pyshortver = rpm.expand("%pyshortver")
|
| |
+ for module_dir in module_dirs:gmatch('[^\\n]+') do
|
| |
+ print(module_dir .. "/__pycache__/*.cpython-" .. pyshortver .. opt .. ".pyc\\n")
|
| |
+ end
|
| |
+ print(rpm.expand("%exclude %{pylibdir}/__pycache__/turtle.cpython-" .. pyshortver .. opt .. ".pyc\\n"))
|
| |
+ }
|
| |
+
|
| |
+ %define remove_pyc_files_declaration() %{?0:
|
| |
+ local module_dirs = [[%{module_dirs}]]
|
| |
+
|
| |
+ function remove_if_pyc_file(opt, pycache_dir, filename)
|
| |
+ local pattern = "%%S+%%.cpython%%-%{pyshortver}" .. opt .. "%%.pyc$"
|
| |
+ local antipattern = "^turtle%%.cpython%%-%{pyshortver}" .. opt .. "%%.pyc$"
|
| |
+ if filename:match(pattern) and not filename:match(antipattern) then
|
| |
+ os.remove(pycache_dir .. filename)
|
| |
+ end
|
| |
+ end
|
| |
+
|
| |
+ function remove_pyc_files_from_dir(opt, pycache_dir)
|
| |
+ local pycache_stat = posix.stat(pycache_dir)
|
| |
+ if pycache_stat and pycache_stat.type == "directory" then
|
| |
+ for filename in posix.files(pycache_dir) do
|
| |
+ remove_if_pyc_file(opt, pycache_dir, filename)
|
| |
+ end
|
| |
+ end
|
| |
+ end
|
| |
+
|
| |
+ function remove_pyc_files(opt)
|
| |
+ for module_dir in module_dirs:gmatch('[^\\n]+') do
|
| |
+ if not module_dir:find('^%%exclude%%s') then
|
| |
+ remove_pyc_files_from_dir(opt, module_dir .. "/__pycache__/")
|
| |
+ end
|
| |
+ end
|
| |
+ end
|
| |
+ }
|
| |
+
|
| |
+
|
| |
%files -n %{pkgname}
|
| |
%doc README.rst
|
| |
|
| |
@@ -1174,71 +1313,42 @@
|
| |
%doc README.rst
|
| |
%endif
|
| |
|
| |
- %dir %{pylibdir}
|
| |
- %dir %{dynload_dir}
|
| |
+ %list_module_dirs
|
| |
|
| |
%license %{pylibdir}/LICENSE.txt
|
| |
|
| |
- %{pylibdir}/lib2to3
|
| |
- %if %{without flatpackage}
|
| |
- %exclude %{pylibdir}/lib2to3/tests
|
| |
- %endif
|
| |
-
|
| |
- %dir %{pylibdir}/unittest/
|
| |
- %dir %{pylibdir}/unittest/__pycache__/
|
| |
- %{pylibdir}/unittest/*.py
|
| |
- %{pylibdir}/unittest/__pycache__/*%{bytecode_suffixes}
|
| |
-
|
| |
- %dir %{pylibdir}/asyncio/
|
| |
- %dir %{pylibdir}/asyncio/__pycache__/
|
| |
- %{pylibdir}/asyncio/*.py
|
| |
- %{pylibdir}/asyncio/__pycache__/*%{bytecode_suffixes}
|
| |
+ %doc %{pylibdir}/distutils/README
|
| |
+ %doc %{pylibdir}/email/architecture.rst
|
| |
+ %doc %{pylibdir}/ctypes/macholib/README.ctypes
|
| |
|
| |
- %dir %{pylibdir}/venv/
|
| |
- %dir %{pylibdir}/venv/__pycache__/
|
| |
- %{pylibdir}/venv/*.py
|
| |
- %{pylibdir}/venv/__pycache__/*%{bytecode_suffixes}
|
| |
+ %{pylibdir}/pydoc_data/_pydoc.css
|
| |
+ %{pylibdir}/lib2to3/*.txt
|
| |
+ %{pylibdir}/lib2to3/*.pickle
|
| |
%{pylibdir}/venv/scripts
|
| |
+ %{pylibdir}/ctypes/macholib/fetch_macholib
|
| |
+ %{pylibdir}/distutils/command/command_template
|
| |
+ # Some of the .py files get removed and replaced by their pycache files
|
| |
+ %{pylibdir}/encodings/*.pyc
|
| |
+ %{pylibdir}/pydoc_data/*.pyc
|
| |
|
| |
- %{pylibdir}/wsgiref
|
| |
- %{pylibdir}/xmlrpc
|
| |
-
|
| |
- %dir %{pylibdir}/ensurepip/
|
| |
- %dir %{pylibdir}/ensurepip/__pycache__/
|
| |
- %{pylibdir}/ensurepip/*.py
|
| |
- %{pylibdir}/ensurepip/__pycache__/*%{bytecode_suffixes}
|
| |
+ %if %{without flatpackage}
|
| |
+ %exclude %{pylibdir}/turtle.py
|
| |
+ %exclude %{pylibdir}/__pycache__/turtle*%{bytecode_suffixes}
|
| |
+ %endif
|
| |
|
| |
- %if %{with rpmwheels}
|
| |
- %exclude %{pylibdir}/ensurepip/_bundled
|
| |
- %else
|
| |
- %dir %{pylibdir}/ensurepip/_bundled
|
| |
+ %if %{without rpmwheels}
|
| |
%{pylibdir}/ensurepip/_bundled/*.whl
|
| |
- %{pylibdir}/ensurepip/_bundled/__init__.py
|
| |
- %{pylibdir}/ensurepip/_bundled/__pycache__/*%{bytecode_suffixes}
|
| |
%endif
|
| |
|
| |
- %dir %{pylibdir}/concurrent/
|
| |
- %dir %{pylibdir}/concurrent/__pycache__/
|
| |
- %{pylibdir}/concurrent/*.py
|
| |
- %{pylibdir}/concurrent/__pycache__/*%{bytecode_suffixes}
|
| |
-
|
| |
- %dir %{pylibdir}/concurrent/futures/
|
| |
- %dir %{pylibdir}/concurrent/futures/__pycache__/
|
| |
- %{pylibdir}/concurrent/futures/*.py
|
| |
- %{pylibdir}/concurrent/futures/__pycache__/*%{bytecode_suffixes}
|
| |
-
|
| |
- %{pylibdir}/pydoc_data
|
| |
-
|
| |
- %{dynload_dir}/_blake2.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/_md5.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/_sha1.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/_sha256.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/_sha3.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/_sha512.%{SOABI_optimized}.so
|
| |
-
|
| |
+ %dir %{dynload_dir}
|
| |
+ %{dynload_dir}/array.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_asyncio.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/audioop.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/binascii.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_bisect.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/_blake2.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_bz2.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/cmath.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_codecs_cn.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_codecs_hk.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_codecs_iso2022.%{SOABI_optimized}.so
|
| |
@@ -1249,49 +1359,50 @@
|
| |
%{dynload_dir}/_crypt.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_csv.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_ctypes.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/_curses.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_curses_panel.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/_curses.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/_datetime.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_dbm.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_decimal.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_elementtree.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/fcntl.%{SOABI_optimized}.so
|
| |
%if %{with gdbm}
|
| |
%{dynload_dir}/_gdbm.%{SOABI_optimized}.so
|
| |
%endif
|
| |
+ %{dynload_dir}/grp.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_hashlib.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_heapq.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_json.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_lsprof.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_lzma.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/math.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/_md5.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/mmap.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_multibytecodec.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_multiprocessing.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/nis.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_opcode.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/ossaudiodev.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/parser.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_pickle.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/_posixshmem.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_posixsubprocess.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/pyexpat.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_queue.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_random.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/readline.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/resource.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/select.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/_sha1.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/_sha256.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/_sha3.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/_sha512.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_socket.%{SOABI_optimized}.so
|
| |
+ %{dynload_dir}/spwd.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_sqlite3.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_ssl.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_statistics.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/_struct.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/array.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/audioop.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/binascii.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/cmath.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/_datetime.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/fcntl.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/grp.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/math.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/mmap.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/nis.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/ossaudiodev.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/parser.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/_posixshmem.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/pyexpat.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/readline.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/resource.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/select.%{SOABI_optimized}.so
|
| |
- %{dynload_dir}/spwd.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/syslog.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/termios.%{SOABI_optimized}.so
|
| |
%{dynload_dir}/unicodedata.%{SOABI_optimized}.so
|
| |
@@ -1303,74 +1414,7 @@
|
| |
|
| |
%dir %{pylibdir}/site-packages/
|
| |
%dir %{pylibdir}/site-packages/__pycache__/
|
| |
- %{pylibdir}/site-packages/README.txt
|
| |
- %{pylibdir}/*.py
|
| |
- %dir %{pylibdir}/__pycache__/
|
| |
- %{pylibdir}/__pycache__/*%{bytecode_suffixes}
|
| |
-
|
| |
- %dir %{pylibdir}/collections/
|
| |
- %dir %{pylibdir}/collections/__pycache__/
|
| |
- %{pylibdir}/collections/*.py
|
| |
- %{pylibdir}/collections/__pycache__/*%{bytecode_suffixes}
|
| |
-
|
| |
- %dir %{pylibdir}/ctypes/
|
| |
- %dir %{pylibdir}/ctypes/__pycache__/
|
| |
- %{pylibdir}/ctypes/*.py
|
| |
- %{pylibdir}/ctypes/__pycache__/*%{bytecode_suffixes}
|
| |
- %{pylibdir}/ctypes/macholib
|
| |
-
|
| |
- %{pylibdir}/curses
|
| |
-
|
| |
- %dir %{pylibdir}/dbm/
|
| |
- %dir %{pylibdir}/dbm/__pycache__/
|
| |
- %{pylibdir}/dbm/*.py
|
| |
- %{pylibdir}/dbm/__pycache__/*%{bytecode_suffixes}
|
| |
-
|
| |
- %dir %{pylibdir}/distutils/
|
| |
- %dir %{pylibdir}/distutils/__pycache__/
|
| |
- %{pylibdir}/distutils/*.py
|
| |
- %{pylibdir}/distutils/__pycache__/*%{bytecode_suffixes}
|
| |
- %{pylibdir}/distutils/README
|
| |
- %{pylibdir}/distutils/command
|
| |
-
|
| |
- %dir %{pylibdir}/email/
|
| |
- %dir %{pylibdir}/email/__pycache__/
|
| |
- %{pylibdir}/email/*.py
|
| |
- %{pylibdir}/email/__pycache__/*%{bytecode_suffixes}
|
| |
- %{pylibdir}/email/mime
|
| |
- %doc %{pylibdir}/email/architecture.rst
|
| |
-
|
| |
- %{pylibdir}/encodings
|
| |
-
|
| |
- %{pylibdir}/html
|
| |
- %{pylibdir}/http
|
| |
-
|
| |
- %dir %{pylibdir}/importlib/
|
| |
- %dir %{pylibdir}/importlib/__pycache__/
|
| |
- %{pylibdir}/importlib/*.py
|
| |
- %{pylibdir}/importlib/__pycache__/*%{bytecode_suffixes}
|
| |
-
|
| |
- %dir %{pylibdir}/json/
|
| |
- %dir %{pylibdir}/json/__pycache__/
|
| |
- %{pylibdir}/json/*.py
|
| |
- %{pylibdir}/json/__pycache__/*%{bytecode_suffixes}
|
| |
-
|
| |
- %{pylibdir}/logging
|
| |
- %{pylibdir}/multiprocessing
|
| |
-
|
| |
- %dir %{pylibdir}/sqlite3/
|
| |
- %dir %{pylibdir}/sqlite3/__pycache__/
|
| |
- %{pylibdir}/sqlite3/*.py
|
| |
- %{pylibdir}/sqlite3/__pycache__/*%{bytecode_suffixes}
|
| |
-
|
| |
- %if %{without flatpackage}
|
| |
- %exclude %{pylibdir}/turtle.py
|
| |
- %exclude %{pylibdir}/__pycache__/turtle*%{bytecode_suffixes}
|
| |
- %endif
|
| |
-
|
| |
- %{pylibdir}/urllib
|
| |
- %{pylibdir}/xml
|
| |
- %{pylibdir}/zoneinfo
|
| |
+ %doc %{pylibdir}/site-packages/README.txt
|
| |
|
| |
%if "%{_lib}" == "lib64"
|
| |
%attr(0755,root,root) %dir %{_prefix}/lib/python%{pybasever}
|
| |
@@ -1393,6 +1437,47 @@
|
| |
|
| |
|
| |
%if %{without flatpackage}
|
| |
+ %{noclean_pycs_marker}
|
| |
+
|
| |
+ %pretrans -n %{pkgname}-libs -p <lua>
|
| |
+ %remove_pyc_files_declaration
|
| |
+ if not posix.stat("%{noclean_pycs_marker}") then
|
| |
+ remove_pyc_files("")
|
| |
+ remove_pyc_files("%%.opt%%-1")
|
| |
+ remove_pyc_files("%%.opt%%-2")
|
| |
+ end
|
| |
+
|
| |
+ %files -n %{pkgname}-libs-bytecode-opt-0
|
| |
+ %list_bytecode_cached
|
| |
+
|
| |
+ %postun -n %{pkgname}-libs-bytecode-opt-0 -p <lua>
|
| |
+ %remove_pyc_files_declaration
|
| |
+ -- Run it only if we are uninstalling
|
| |
+ if arg[2] == 0 then
|
| |
+ remove_pyc_files("")
|
| |
+ end
|
| |
+
|
| |
+ %files -n %{pkgname}-libs-bytecode-opt-1
|
| |
+ %list_bytecode_cached .opt-1
|
| |
+
|
| |
+ %postun -n %{pkgname}-libs-bytecode-opt-1 -p <lua>
|
| |
+ %remove_pyc_files_declaration
|
| |
+ if arg[2] == 0 then
|
| |
+ remove_pyc_files("%%.opt%%-1")
|
| |
+ end
|
| |
+
|
| |
+ %files -n %{pkgname}-libs-bytecode-opt-2
|
| |
+ %list_bytecode_cached .opt-2
|
| |
+
|
| |
+ %postun -n %{pkgname}-libs-bytecode-opt-2 -p <lua>
|
| |
+ %remove_pyc_files_declaration
|
| |
+ if arg[2] == 0 then
|
| |
+ remove_pyc_files("%%.opt%%-2")
|
| |
+ end
|
| |
+ %endif
|
| |
+
|
| |
+
|
| |
+ %if %{without flatpackage}
|
| |
%files -n %{pkgname}-devel
|
| |
%endif
|
| |
|
| |
@@ -1640,6 +1725,9 @@
|
| |
# ======================================================
|
| |
|
| |
%changelog
|
| |
+ * Mon Aug 31 2020 Miro Hrončok <mhroncok@redhat.com> - 3.9.0~rc1-3
|
| |
+ - Split bytecode cache to optional subpackages
|
| |
+
|
| |
* Wed Aug 12 2020 Petr Viktorin <pviktori@redhat.com> - 3.9.0~rc1-2
|
| |
- In sys.version and initial REPL message, list the source commit as "default"
|
| |
|
| |
This creates three subpackages with the bytecode cache (.pyc files):
python3-libs-bytecode-opt-0
python3-libs-bytecode-opt-1
python3-libs-bytecode-opt-2
The non-optimized (opt-0) package is Recommended by python3-libs and hence
installed by default, but removable (opt-out).
The other two are only Suggested and hence they are installable but not
installed by default (opt-in).
The packages contain the pre-compiled cache, such as:
/usr/lib64/python3.9/__pycache__/random.cpython-39.pyc
/usr/lib64/python3.9/__pycache__/random.cpython-39.opt-1.pyc
/usr/lib64/python3.9/__pycache__/random.cpython-39.opt-2.pyc
The paths are also %ghosted in the "main" python3-libs package, that owns:
.py
files, e.g./usr/lib64/python3.9/random.py
/usr/lib64/python3.9/__pycache__/
and other__pycache__
directories (but not the.pyc
files in it)The new bytecode packages Require python3-libs.
This allows to save significant space for installations where the bytecode
cache is not important.
Two important things to note about this approach:
Cross-package hardlinks are not likely to work, hence when all three
packages are installed together, more disk space is claimed than before.
Python will create the missing bytecode cache files on demand when run as root.
When in restricted SELinux context, this will fail.
A SELinux alert will be generated unless suppressed, which we plan to do,
see https://github.com/fedora-selinux/selinux-policy/pull/404
Co-Authored-By: @dormouse