How to make a python slackware package without setup.py?
by brobr from LinuxQuestions.org on (#5SD11)
Hi, more and more our trusted way of creating Slackware packages for python modules via Code:python3 setup.py install --root=$PKG is getting more difficult as setup.py files are looked upon as redundant and outdated. They're no longer shipped, supposedly all should be done via pip.
When python-tomli was added the Changelog mentioned:
Quote:
Trying this* with other recent python modules that don't bother with supplying a setup py (twine, furo, sphinx-package-builder), did work with twine but not with furo and the sphinx-package-builder.
*Code:# Use this setup.py shim:
cat << EOF > setup.py
from setuptools import setup
setup(name="${SRCNAM}", version="${VERSION}", packages=["${SRCNAM}"], package_data={"": ["*"]})
EOF
# With the shim, it's a good idea to use "unshare -n" to prevent downloading
# anything extra:
unshare -n python3 setup.py install --root=$PKG || exit 1It failed with error-message Quote:
Did I miss something?
Instead, the blurb used before Code:python3 -m pip install \
--no-deps\
--no-warn-script-location \
. --root=$PKG
#clean up pip-files in /root or whoever runs the script
rm -r ~/.cache/pip/*helped to create packages for furo and sphinx-theme-builder.
What would the best/standard method to adopt to create Slackbuilds to create such python packages???
When python-tomli was added the Changelog mentioned:
Quote:
l/python-tomli-1.2.2-x86_64-1.txz: Added. This is needed by setuptools_scm. Also, the SlackBuild contains a nice example of using a setup.py shim to setuptools for a Python module that only contains pyproject.toml and not setup.py. Thanks to Heinz Wiesinger. |
*Code:# Use this setup.py shim:
cat << EOF > setup.py
from setuptools import setup
setup(name="${SRCNAM}", version="${VERSION}", packages=["${SRCNAM}"], package_data={"": ["*"]})
EOF
# With the shim, it's a good idea to use "unshare -n" to prevent downloading
# anything extra:
unshare -n python3 setup.py install --root=$PKG || exit 1It failed with error-message Quote:
error: package directory '<$SRCNAM>' does not exist |
Instead, the blurb used before Code:python3 -m pip install \
--no-deps\
--no-warn-script-location \
. --root=$PKG
#clean up pip-files in /root or whoever runs the script
rm -r ~/.cache/pip/*helped to create packages for furo and sphinx-theme-builder.
What would the best/standard method to adopt to create Slackbuilds to create such python packages???