Build under Python 3

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2016-10-26 23:33:40 +03:00
parent b34c009fb2
commit d4d07f135f
6 changed files with 22 additions and 11 deletions

View file

@ -9,4 +9,3 @@ Small changes in the code each time more appreciated.
Keep the style code applicable items.
Please ensure your changes work in Python 2.7.5+
Python 3 not support yet.

View file

@ -5,7 +5,7 @@ Installation
Python & OS Support
-------------------
Slpkg works with Python versions 2.7.5+ (Python 3 not supported yet)
Slpkg works with Python versions 2.7.5+ and Python 3.x (tested in 3.5+).
Slpkg works on Slackware distribution and possibly in some Slackware based
distribution like SalixOS, Slackel etc.
@ -19,7 +19,7 @@ There are mainly 3 ways:
1) Suggested method, download latest slpkg version from:
https://github.com/dslackw/slpkg/releases
Untar or unzip the archive, change directory in slpkg-<version>
and run './install.sh'.
and run './install.sh' or 'PYTHON3=yes ./install.sh' for Python 3.
slpkg auto-installed as Slackware package (root privileges are required).
2) Download binary package from https://github.com/dslackw/slpkg/releases

View file

@ -78,11 +78,16 @@ Download latest release:
.. code-block:: bash
Required root privileges
$ tar xvf slpkg-3.2.1.tar.gz
$ cd slpkg-3.2.1
$ ./install.sh
If you want to build slpkg for use with Python 3.x (needs the
optional dependency python3) pass the script PYTHON3=yes, like:
PYTHON3=yes ./install.sh
Installed as Slackware package
Uninstall:

View file

@ -22,6 +22,9 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# If you want to build slpkg for use with Python 3.x (needs the
# optional dependency python3) pass the script PYTHON3=yes, like:
# PYTHON3=yes ./install.sh
__version() {
# Grab version from __metadata_.py file

View file

@ -81,6 +81,8 @@ setup(
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Unix Shell",
"Topic :: Software Development :: Build Tools",
"Topic :: System :: Archiving :: Packaging",

View file

@ -63,6 +63,9 @@ fi
set -e
PYTHON=python
[ "${PYTHON3:-no}" = "yes" ] && PYTHON=python3
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
@ -80,14 +83,13 @@ find -L . \
# avoid install man page and configuration files over setup.py
sed -i 's/if "install"/if ""/' setup.py
python setup.py install --root=$PKG
# Python 3 support
if [ "$PYTHON3" = "yes" ]; then
sh convert-py3k
cd py3k/$PRGNAM
fi
### Python 3 support ###
# if $(python3 -c 'import sys' 2>/dev/null); then
# sh convert-py3k
# cd py3k/$PRGNAM
# python3 setup.py install --root=$PKG
# fi
$PYTHON setup.py install --root=$PKG
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true