matplotlib: Update to 3.0.0 (#4434)
Matplotlib is Python 3 only now and has auto backend detection so move all the backend related dependencies into optdepends. This splits the package into two PKGBUILD files, one building a Python 2 version providing 2.2.x and one building a Python 3 version providing 3.x+
This commit is contained in:
committed by
Алексей
parent
16e24e4f6e
commit
182de74ab4
@@ -1,144 +0,0 @@
|
||||
# Contributor: Runar Tenfjord < runar dot tenfjord at gmail dot com >
|
||||
|
||||
_realname=matplotlib
|
||||
pkgbase=mingw-w64-python-${_realname}
|
||||
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
||||
pkgver=2.2.3
|
||||
pkgrel=3
|
||||
pkgdesc="A python plotting library, making publication quality plots (mingw-w64)"
|
||||
arch=('any')
|
||||
url='https://matplotlib.org/'
|
||||
license=('custom')
|
||||
makedepends=(
|
||||
"${MINGW_PACKAGE_PREFIX}-python2"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-setuptools"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-setuptools"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-pytz"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-pytz"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-numpy"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-numpy"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-cairo"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-cairo"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-pyqt5"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-pyqt5"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-dateutil"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-dateutil"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-pyparsing"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-pyparsing"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-cycler"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-cycler"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-kiwisolver"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-kiwisolver"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-backports.functools_lru_cache"
|
||||
"${MINGW_PACKAGE_PREFIX}-freetype"
|
||||
"${MINGW_PACKAGE_PREFIX}-libpng"
|
||||
#"${MINGW_PACKAGE_PREFIX}-qhull"
|
||||
)
|
||||
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/matplotlib/matplotlib/archive/v${pkgver}.tar.gz"
|
||||
setupext.py.patch
|
||||
setup.py.patch)
|
||||
sha256sums=('da5b804222864a8e854ed68f16dcbc8b2fa096537d84f879cc8289db368735c8'
|
||||
'7ecd678f2325486fc79998dd11f79a5c0e0284d3c4260678f47c4b24d0a3d893'
|
||||
'2ace7d4fe23ba9e96f2c81f827c8ea6bc65c532e6bd4eee3a655aae1ae6dab17')
|
||||
noextract=("${_realname}-${pkgver}.tar.gz")
|
||||
|
||||
prepare() {
|
||||
# Clean up old sources so re-patching doesn't fail.
|
||||
[[ -d ${srcdir}/${_realname}-${pkgver} ]] && rm -rf $srcdir/${_realname}-${pkgver}
|
||||
tar -xzvf ${_realname}-${pkgver}.tar.gz -C ${srcdir}
|
||||
|
||||
cd ${srcdir}/${_realname}-${pkgver}
|
||||
patch -p1 -i ${srcdir}/setupext.py.patch
|
||||
patch -p1 -i ${srcdir}/setup.py.patch
|
||||
cd ${srcdir}
|
||||
|
||||
cp -a ${_realname}-${pkgver} ${_realname}-py2-${pkgver}
|
||||
cp -a ${_realname}-${pkgver} ${_realname}-py3-${pkgver}
|
||||
|
||||
cd ${srcdir}/${_realname}-py3-${pkgver}
|
||||
# remove cairo which fails for python3
|
||||
sed -i 's/setupext\.BackendGtk3Cairo/#setupext\.BackendGtk3Cairo/g' setup.py
|
||||
sed -i 's/setupext\.BackendCairo/#setupext\.BackendCairo/g' setup.py
|
||||
|
||||
cd ${srcdir}/${_realname}-py2-${pkgver}
|
||||
sed -e "s|#![ ]*/usr/bin/python$|#!/usr/bin/env python2|" \
|
||||
-e "s|#![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \
|
||||
-e "s|#![ ]*/bin/env python$|#!/usr/bin/env python2|" \
|
||||
-i $(find . -name '*.py')
|
||||
}
|
||||
|
||||
build() {
|
||||
cd ${srcdir}/${_realname}-py2-${pkgver}
|
||||
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
||||
${MINGW_PREFIX}/bin/python2 setup.py build
|
||||
|
||||
cd ${srcdir}/${_realname}-py3-${pkgver}
|
||||
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
||||
${MINGW_PREFIX}/bin/python3 setup.py build
|
||||
}
|
||||
|
||||
package_python3-matplotlib() {
|
||||
depends=(
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-pytz"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-numpy"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-cairo"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-cycler"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-pyqt5"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-dateutil"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-pyparsing"
|
||||
"${MINGW_PACKAGE_PREFIX}-python3-kiwisolver"
|
||||
"${MINGW_PACKAGE_PREFIX}-freetype"
|
||||
"${MINGW_PACKAGE_PREFIX}-libpng"
|
||||
#"${MINGW_PACKAGE_PREFIX}-qhull"
|
||||
)
|
||||
cd ${srcdir}/${_realname}-py3-${pkgver}
|
||||
|
||||
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
||||
${MINGW_PREFIX}/bin/python3 setup.py install -O1 --skip-build \
|
||||
--root="${pkgdir}" --prefix=${MINGW_PREFIX}
|
||||
|
||||
install -Dm644 doc/users/license.rst "${pkgdir}${MINGW_PREFIX}"/share/licenses/python3-matplotlib/LICENSE
|
||||
}
|
||||
|
||||
package_python2-matplotlib() {
|
||||
depends=(
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-pytz"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-numpy"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-cairo"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-cycler"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-pyqt5"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-dateutil"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-pyparsing"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-kiwisolver"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-backports.functools_lru_cache"
|
||||
"${MINGW_PACKAGE_PREFIX}-freetype"
|
||||
"${MINGW_PACKAGE_PREFIX}-libpng"
|
||||
#"${MINGW_PACKAGE_PREFIX}-qhull"
|
||||
)
|
||||
cd ${srcdir}/${_realname}-py2-${pkgver}
|
||||
|
||||
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
||||
${MINGW_PREFIX}/bin/python2 setup.py install -O1 --skip-build \
|
||||
--root="${pkgdir}" --prefix=${MINGW_PREFIX}
|
||||
|
||||
install -Dm644 doc/users/license.rst "${pkgdir}${MINGW_PREFIX}"/share/licenses/python2-matplotlib/LICENSE
|
||||
}
|
||||
|
||||
package_mingw-w64-i686-python2-matplotlib() {
|
||||
package_python2-matplotlib
|
||||
}
|
||||
|
||||
package_mingw-w64-i686-python3-matplotlib() {
|
||||
package_python3-matplotlib
|
||||
}
|
||||
|
||||
package_mingw-w64-x86_64-python2-matplotlib() {
|
||||
package_python2-matplotlib
|
||||
}
|
||||
|
||||
package_mingw-w64-x86_64-python3-matplotlib() {
|
||||
package_python3-matplotlib
|
||||
}
|
||||
|
||||
# vim:set ts=2 sw=2 et:
|
||||
@@ -1,11 +0,0 @@
|
||||
--- matplotlib-2.1.2/setup.py.orig 2018-01-18 07:21:34.000000000 +0300
|
||||
+++ matplotlib-2.1.2/setup.py 2018-01-25 08:35:39.807755700 +0300
|
||||
@@ -102,7 +102,7 @@
|
||||
setupext.BackendGtk3Agg(),
|
||||
setupext.BackendGtk3Cairo(),
|
||||
setupext.BackendGtkAgg(),
|
||||
- setupext.BackendTkAgg(),
|
||||
+ #setupext.BackendTkAgg(),
|
||||
setupext.BackendWxAgg(),
|
||||
setupext.BackendGtk(),
|
||||
setupext.BackendAgg(),
|
||||
@@ -1,207 +0,0 @@
|
||||
--- matplotlib-2.1.2/setupext.py.orig 2018-03-17 03:56:24.000000000 +0100
|
||||
+++ matplotlib-2.1.2/setupext.py 2018-05-26 16:33:06.183466400 +0200
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
PY3min = (sys.version_info[0] >= 3)
|
||||
|
||||
+MSYS = "MSYSTEM" in os.environ
|
||||
+
|
||||
|
||||
def _get_xdg_cache_dir():
|
||||
"""
|
||||
@@ -56,9 +58,17 @@
|
||||
LOCAL_FREETYPE_VERSION = '2.6.1'
|
||||
LOCAL_FREETYPE_HASH = _freetype_hashes.get(LOCAL_FREETYPE_VERSION, 'unknown')
|
||||
|
||||
-if sys.platform != 'win32':
|
||||
+if sys.platform != 'win32' or MSYS:
|
||||
if not PY3min:
|
||||
from commands import getstatusoutput
|
||||
+ def getstatusoutput(cmd):
|
||||
+ """Return (status, output) of executing cmd in a shell."""
|
||||
+ pipe = os.popen(cmd, 'r')
|
||||
+ text = pipe.read()
|
||||
+ sts = pipe.close()
|
||||
+ if sts is None: sts = 0
|
||||
+ if text[-1:] == '\n': text = text[:-1]
|
||||
+ return sts, text
|
||||
else:
|
||||
from subprocess import getstatusoutput
|
||||
|
||||
@@ -136,10 +146,11 @@
|
||||
Returns `True` if `filename` can be found in one of the
|
||||
directories in `include_dirs`.
|
||||
"""
|
||||
- if sys.platform == 'win32':
|
||||
+ if sys.platform == 'win32' and not MSYS:
|
||||
include_dirs = list(include_dirs) # copy before modify
|
||||
include_dirs += os.environ.get('INCLUDE', '.').split(os.pathsep)
|
||||
for dir in include_dirs:
|
||||
+ dir = os.popen(' '.join(['cygpath', '-w', dir])).readline().strip()
|
||||
if os.path.exists(os.path.join(dir, filename)):
|
||||
return True
|
||||
return False
|
||||
@@ -266,6 +277,7 @@
|
||||
"""
|
||||
ext = DelayedExtension(name, files, *args, **kwargs)
|
||||
for dir in get_base_dirs():
|
||||
+ dir = os.popen(' '.join(['cygpath', '-w', dir])).readline().strip()
|
||||
include_dir = os.path.join(dir, 'include')
|
||||
if os.path.exists(include_dir):
|
||||
ext.include_dirs.append(include_dir)
|
||||
@@ -301,7 +313,7 @@
|
||||
"""
|
||||
Determines whether pkg-config exists on this machine.
|
||||
"""
|
||||
- if sys.platform == 'win32':
|
||||
+ if sys.platform == 'win32' and not MSYS:
|
||||
self.has_pkgconfig = False
|
||||
else:
|
||||
try:
|
||||
@@ -310,7 +322,7 @@
|
||||
self.pkg_config = 'pkg-config'
|
||||
|
||||
self.set_pkgconfig_path()
|
||||
- status, output = getstatusoutput(self.pkg_config + " --help")
|
||||
+ status, output = getstatusoutput('sh -c "' + self.pkg_config + ' --help"')
|
||||
self.has_pkgconfig = (status == 0)
|
||||
if not self.has_pkgconfig:
|
||||
print("IMPORTANT WARNING:")
|
||||
@@ -351,7 +363,7 @@
|
||||
command = "{0} --libs --cflags ".format(executable)
|
||||
|
||||
try:
|
||||
- output = check_output(command, shell=True,
|
||||
+ output = check_output('sh -c "%s"' % command, shell=True,
|
||||
stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError:
|
||||
pass
|
||||
@@ -361,11 +373,16 @@
|
||||
for token in output.split():
|
||||
attr = flag_map.get(token[:2])
|
||||
if attr is not None:
|
||||
- getattr(ext, attr).insert(0, token[2:])
|
||||
+ if attr.endswith('dirs'):
|
||||
+ dir = os.popen(' '.join(['cygpath', '-w', token[2:]])).readline().strip()
|
||||
+ getattr(ext, attr).insert(0, dir)
|
||||
+ else:
|
||||
+ getattr(ext, attr).insert(0, token[2:])
|
||||
|
||||
if use_defaults:
|
||||
basedirs = get_base_dirs()
|
||||
for base in basedirs:
|
||||
+ base = os.popen(' '.join(['cygpath', '-w', base])).readline().strip()
|
||||
for include in default_include_dirs:
|
||||
dir = os.path.join(base, include)
|
||||
if os.path.exists(dir):
|
||||
@@ -387,7 +404,7 @@
|
||||
return None
|
||||
|
||||
status, output = getstatusoutput(
|
||||
- self.pkg_config + " %s --modversion" % (package))
|
||||
+ 'sh -c "' + self.pkg_config + ' %s --modversion"' % (package))
|
||||
if status == 0:
|
||||
return output
|
||||
return None
|
||||
@@ -1039,14 +1056,14 @@
|
||||
if options.get('local_freetype'):
|
||||
return "Using local version for testing"
|
||||
|
||||
- if sys.platform == 'win32':
|
||||
+ if sys.platform == 'win32' and not MSYS:
|
||||
try:
|
||||
check_include_file(get_include_dirs(), 'ft2build.h', 'freetype')
|
||||
except CheckFailed:
|
||||
check_include_file(get_include_dirs(), 'freetype2\\ft2build.h', 'freetype')
|
||||
return 'Using unknown version found on system.'
|
||||
|
||||
- status, output = getstatusoutput("freetype-config --ftversion")
|
||||
+ status, output = getstatusoutput('sh -c "freetype-config --ftversion"')
|
||||
if status == 0:
|
||||
version = output
|
||||
else:
|
||||
@@ -1071,6 +1088,8 @@
|
||||
return version
|
||||
# Return the first version found in the include dirs.
|
||||
for include_dir in ext.include_dirs:
|
||||
+ include_dir = os.popen(' '.join(['cygpath', '-w', include_dir])).readline().st
|
||||
+ rip()
|
||||
header_fname = os.path.join(include_dir, 'freetype.h')
|
||||
if os.path.exists(header_fname):
|
||||
major, minor, patch = 0, 0, 0
|
||||
@@ -1281,11 +1300,11 @@
|
||||
}
|
||||
|
||||
def check(self):
|
||||
- if sys.platform == 'win32':
|
||||
+ if sys.platform == 'win32' and not MSYS:
|
||||
check_include_file(get_include_dirs(), 'png.h', 'png')
|
||||
return 'Using unknown version found on system.'
|
||||
|
||||
- status, output = getstatusoutput("libpng-config --version")
|
||||
+ status, output = getstatusoutput('sh -c "libpng-config --version"')
|
||||
if status == 0:
|
||||
version = output
|
||||
else:
|
||||
@@ -1543,7 +1562,7 @@
|
||||
return ext
|
||||
|
||||
def add_flags(self, ext):
|
||||
- if sys.platform == 'win32':
|
||||
+ if sys.platform == 'win32' and not MSYS:
|
||||
def getoutput(s):
|
||||
ret = os.popen(s).read().strip()
|
||||
return ret
|
||||
@@ -1598,7 +1617,7 @@
|
||||
'm' in ext.libraries):
|
||||
ext.libraries.remove('m')
|
||||
|
||||
- elif sys.platform != 'win32':
|
||||
+ elif sys.platform != 'win32' or MSYS:
|
||||
pkg_config.setup_extension(ext, 'pygtk-2.0')
|
||||
pkg_config.setup_extension(ext, 'gtk+-2.0')
|
||||
|
||||
@@ -2013,7 +2032,7 @@
|
||||
|
||||
def check(self):
|
||||
try:
|
||||
- output = check_output('dvipng -version', shell=True,
|
||||
+ output = check_output('sh -c "dvipng -version"', shell=True,
|
||||
stderr=subprocess.STDOUT)
|
||||
return "version %s" % output.splitlines()[1].decode().split()[-1]
|
||||
except (IndexError, ValueError, subprocess.CalledProcessError):
|
||||
@@ -2025,14 +2044,14 @@
|
||||
optional = True
|
||||
|
||||
def check(self):
|
||||
- if sys.platform == 'win32':
|
||||
+ if sys.platform == 'win32' and not MSYS:
|
||||
# mgs is the name in miktex
|
||||
gs_execs = ['gswin32c', 'gswin64c', 'mgs', 'gs']
|
||||
else:
|
||||
gs_execs = ['gs']
|
||||
for gs_exec in gs_execs:
|
||||
try:
|
||||
- command = gs_exec + ' --version'
|
||||
+ command = 'sh -c "%s --version"' % gs_exec
|
||||
output = check_output(command, shell=True,
|
||||
stderr=subprocess.STDOUT)
|
||||
return "version %s" % output.decode()[:-1]
|
||||
@@ -2048,7 +2067,7 @@
|
||||
|
||||
def check(self):
|
||||
try:
|
||||
- output = check_output('latex -version', shell=True,
|
||||
+ output = check_output('sh -c "latex -version"', shell=True,
|
||||
stderr=subprocess.STDOUT)
|
||||
line = output.splitlines()[0].decode()
|
||||
pattern = '(3\.1\d+)|(MiKTeX \d+.\d+)'
|
||||
@@ -2064,7 +2083,7 @@
|
||||
|
||||
def check(self):
|
||||
try:
|
||||
- output = check_output('pdftops -v', shell=True,
|
||||
+ output = check_output('sh -c "pdftops -v"', shell=True,
|
||||
stderr=subprocess.STDOUT)
|
||||
for line in output.splitlines():
|
||||
line = line.decode()
|
||||
Reference in New Issue
Block a user