TODO:py3 packages: Difference between revisions
(py-tornado ported) |
m (RfD: This page is now useless as Alpine exclusively uses python3 now.) |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Delete|Alpine exclusively uses python3 now}} | |||
== Explanation == | == Explanation == | ||
Line 23: | Line 22: | ||
# Send pull request to https://github.com/alpinelinux/aports. | # Send pull request to https://github.com/alpinelinux/aports. | ||
If you have any questions, then don’t hesitate to ask on IRC [ | If you have any questions, then don’t hesitate to ask on IRC [ircs://irc.oftc.net/alpine-devel #alpine-devel]! | ||
=== APKBUILD === | === APKBUILD === | ||
Line 46: | Line 45: | ||
build() { | build() { | ||
cd "$builddir" | cd "$builddir" | ||
python2 setup.py build | python2 setup.py build | ||
python3 setup.py build | python3 setup.py build | ||
} | } | ||
Line 82: | Line 81: | ||
Notes: | Notes: | ||
* _pkgname is the package’s real name on PyPI. | * _pkgname is the package’s real name on PyPI. | ||
== List of abuilds without Python 3 support == | == List of abuilds without Python 3 support == | ||
Line 103: | Line 101: | ||
| py-backports.ssl_match_hostname | | py-backports.ssl_match_hostname | ||
| Not needed for >=py3.4 | | Not needed for >=py3.4 | ||
|- | |- | ||
| py-bluez | | py-bluez | ||
Line 607: | Line 602: | ||
|- | |- | ||
|} | |} | ||
[[Category:Python]] |
Latest revision as of 05:25, 26 August 2023
This material is proposed for deletion ... Alpine exclusively uses python3 now
(Discuss) |
Explanation
Python 2 and 3 installs modules into different directories, the compiled bytecode (*.pyc files) is different and native extensions are linked against different Python shared library. Therefore to support both versions, we need to build two packages. Since the source is the same, we do it as one APKBUILD that provides two subpackages: py2- and py3-. Base package py- is then a metapackage that pulls py2- subpackage if python2 is installed or py3- subpackage if python3 is installed.
How to do it
Before you start, prepare your environment for building packages (Creating an Alpine package).
- Take some package from the list below. Higher priority have packages with some compiled code (those have arch="all").
- Check if the Python package is compatible with Python 3. Tip: When you look into the package’s setup.py file, there are usually declared some classifiers like Programming Language :: Python :: 2 and Programming Language :: Python :: 3.
- If it’s not compatible with Python 3, then write it into the table below as a note.
- If it’s compatible with Python 3, then continue with next steps.
- Check if requirements in the package’s setup.py corresponds with the abuild’s depends. Some Python packages have additional dependencies depending on the Python version (for Alpine is relevant just 2.7 and 3.5).
- Adjust the APKBUILD (see below).
- Try to build it.
- If everything is okay, commit the change (use commit message like <repo>/<pkgname>: add py2/py3 subpackages).
- Send pull request to https://github.com/alpinelinux/aports.
If you have any questions, then don’t hesitate to ask on IRC #alpine-devel!
APKBUILD
APKBUILD for a package supporting both Python 2 and Python 3 should look like this:
pkgname=py-foo _pkgname=PyFoo pkgver=1.0.0 pkgrel=1 pkgdesc="A package description" url="https://github.com/example/foo" arch="noarch" license="MIT" depends="py-bar" makedepends="python2-dev python3-dev py-setuptools" subpackages="py2-${pkgname#py-}:_py2 py3-${pkgname#py-}:_py3" source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz" builddir="$srcdir/$_pkgname-$pkgver" build() { cd "$builddir" python2 setup.py build python3 setup.py build } package() { mkdir -p "$pkgdir" } _py2() { replaces="$pkgname" depends="${depends//py-/py2-}" _py python2 } _py3() { depends="${depends//py-/py3-}" _py python3 } _py() { local python="$1" pkgdesc="$pkgdesc (for $python)" depends="$depends $python" install_if="$pkgname=$pkgver-r$pkgrel $python" cd "$builddir" $python setup.py install --prefix=/usr --root="$subpkgdir" }
- If the package contains some compiled code (native extensions), then add arch="all" into the _py() function (between pkgdesc and depends).
- If the package doesn’t have any dependencies, then omit depends="" in the _py2() and _py3() functions.
- If the package uses variable _builddir, then replace it with builddir (the former is older format).
Notes:
- _pkgname is the package’s real name on PyPI.
List of abuilds without Python 3 support
main
Pkgname | Notes |
---|---|
py-alabaster | |
py-avahi | |
py-babel | |
py-backports.ssl_match_hostname | Not needed for >=py3.4 |
py-bluez | |
py-boto | |
py-cairo | |
py-cliapp | |
py-configshell | |
py-country | |
py-dbus | |
py-django | |
py-django-contact-form | |
py-django-djblets | |
py-django-extra-views | |
py-django-haystack | |
py-django-oscar | |
py-django-pipeline | |
py-django-registation | |
py-django-simple-captcha | |
py-django-sorl-thumbnail | |
py-django-tables2 | |
py-django-treebeard | |
py-django-widget-tweaks | |
py-ediarpc | |
py-egenix-mx-base | doesn’t support py3 |
py-exifread | |
py-eyed3 | |
py-factory-boy | |
py-farstream0.1 | |
py-feedparser | |
py-flask-assets | |
py-flask-script | |
py-flask-wtf | |
py-flup | |
py-funcsigs | |
py-fuse | |
py-gamin | |
py-gdbm | |
py-genshi | |
py-gflags | |
py-gnome | |
py-gnome-bonobo | |
py-gnome-gconf | |
py-gnome-gnomevfs | |
py-gnome-libgnome | |
py-gnutls | |
py-gobject | |
py-gobject3 | |
py-google-api-python-client | |
py-gst0.10 | |
py-gtk | |
py-gtk-demo | |
py-gunicorn | |
py-gv | |
py-hgtools | |
py-hiredis | |
py-hoedown | |
py-httplib2 | |
py-icu | |
py-imagesize | |
py-imaging | |
py-irc | |
py-irc-scripts | |
py-jwt | |
py-larch | |
py-ldb | |
py-libmount | |
py-libproxy | |
py-libxml2 | |
py-libxslt | |
py-lockfile | |
py-mako | |
py-mccabe | |
py-meld3 | |
py-mock | |
py-munkres | |
py-musicbrainzngs | |
py-mutagen | |
py-mysqldb | |
py-newt | |
py-nose | |
py-oauth2 | |
py-oauth2client | |
py-parsing | |
py-pbr | |
py-pep8 | |
py-pgen | |
py-phonenumbers | |
py-pillow | |
py-purl | |
py-pygments | |
py-pylast | |
py-redis | |
py-roman | |
py-rrd | |
py-rsa | |
py-samba | |
py-simpleparse | |
py-singledispatch | Not needed for >=py3.3 |
py-snowballstemmer | |
py-sphinx | |
py-sphinx_rtd_theme | |
py-subversion | |
py-talloc | |
py-tdb | |
py-templayer | |
py-tevent | |
py-tracing | |
py-ttystatus | |
py-twisted | |
py-twitter | |
py-unbound | |
py-unidecode | |
py-uritemplate | |
py-urlgrabber | |
py-urlnorm | |
py-urwid | |
py-urwid-examples | |
py-vobject | |
py-webassets | |
py-wtforms | |
py-xml |
community
Pkgname | Notes |
---|---|
py-acme | |
py-argh | |
py-configargparse | |
py-crcmod | |
py-dialog | |
py-distutils-extra | |
py-django-appconf | |
py-django-compressor | |
py-django1.5 | unmaintained version |
py-ethtool | |
py-gammu | |
py-gpiozero | |
py-graphviz | |
py-gtkglext | |
py-impacket | |
py-ipaddr | |
py-jellyfish | |
py-libplist | |
py-libteam | |
py-livereload | |
py-lz4 | |
py-mechanize | |
py-ndg_httpsclient | |
py-numpy | |
py-opencl | |
py-opengl-accelerate | |
py-parsedatetime | |
py-pathtools | |
py-pysqlite | |
py-rencode | |
py-rpigpio | |
py-rpm | |
py-rtslib | |
py-sensehat | |
py-skywriter-hat | |
py-slowaes | |
py-sphinx-autobuild | |
py-tempita | |
py-udev | |
py-watchdog | |
py-zope-component | |
py-zope-event | |
py2-impacket | |
py2-pysqlite | |
py2-tempita |