From 106c7bb20229fa1cad21ddac1224deefa237c036 Mon Sep 17 00:00:00 2001 From: alihanozturk Date: Thu, 16 Feb 2017 08:51:44 +0300 Subject: [PATCH] python3-cairo:fix --- .../language/python3/python3-cairo/actions.py | 19 +-- .../python3-cairo/files/pycairo-setup.patch | 131 ++++++++++++++++++ .../language/python3/python3-cairo/pspec.xml | 4 +- 3 files changed, 139 insertions(+), 15 deletions(-) create mode 100644 programming/language/python3/python3-cairo/files/pycairo-setup.patch diff --git a/programming/language/python3/python3-cairo/actions.py b/programming/language/python3/python3-cairo/actions.py index 2a81c8075d..df3503704f 100644 --- a/programming/language/python3/python3-cairo/actions.py +++ b/programming/language/python3/python3-cairo/actions.py @@ -4,21 +4,14 @@ # Licensed under the GNU General Public License, version 3. # See the file http://www.gnu.org/licenses/gpl.txt -from pisi.actionsapi import autotools -from pisi.actionsapi import shelltools +from pisi.actionsapi import pythonmodules from pisi.actionsapi import get from pisi.actionsapi import pisitools -shelltools.export("JOBS", get.makeJOBS().replace("-j", "")) - def setup(): - shelltools.export("PYTHON","/usr/bin/python3") - shelltools.system("python3 ./waf configure --prefix=/usr --libdir=/usr/lib") + pythonmodules.compile(pyVer = "3") + +def install(): + pythonmodules.install(pyVer = "3") -def build(): - shelltools.system("python3 waf build -v") - -def install(): - shelltools.system("DESTDIR=%s python3 waf install" % get.installDIR()) - - pisitools.dodoc("AUTHORS", "COPYING", "README","COPYING*") \ No newline at end of file + pisitools.dodoc("AUTHORS", "COPYING", "README","COPYING*") diff --git a/programming/language/python3/python3-cairo/files/pycairo-setup.patch b/programming/language/python3/python3-cairo/files/pycairo-setup.patch new file mode 100644 index 0000000000..1a6cb1dbb9 --- /dev/null +++ b/programming/language/python3/python3-cairo/files/pycairo-setup.patch @@ -0,0 +1,131 @@ +diff -urN pycairo-1.10.0.orig/setup.py pycairo-1.10.0/setup.py +--- pycairo-1.10.0.orig/setup.py 1970-01-01 00:00:00.000000000 +0000 ++++ pycairo-1.10.0/setup.py 2013-07-16 05:59:25.414054186 +0000 +@@ -0,0 +1,127 @@ ++#!/usr/bin/env python ++ ++import distutils.core as dic ++import distutils.dir_util as dut ++import distutils.file_util as fut ++import distutils.sysconfig as dsy ++import io ++import os ++import subprocess ++import sys ++ ++pycairo_version = '1.10.0' ++cairo_version_required = '1.10.1' ++python_version_required = (3,1) ++pkgconfig_file = 'py3cairo.pc' ++config_file = 'src/config.h' ++ ++LIBDIR = os.uname ()[-1] == 'x86_64' and 'lib64' or 'lib' ++ ++def call(command): ++ pipe = subprocess.Popen(command, shell=True, ++ stdout=subprocess.PIPE, ++ stderr=subprocess.PIPE) ++ pipe.wait() ++ return pipe ++ ++def pkg_config_version_check(pkg, version): ++ check = '%s >= %s' % (pkg, version) ++ pipe = call("pkg-config --print-errors --exists '%s'" % (check,)) ++ if pipe.returncode == 0: ++ print(check, ' Successful') ++ else: ++ print(check, ' Failed') ++ raise SystemExit(pipe.stderr.read().decode()) ++ ++def pkg_config_parse(opt, pkg): ++ check = "pkg-config %s %s" % (opt, pkg) ++ pipe = call("pkg-config %s %s" % (opt, pkg)) ++ if pipe.returncode != 0: ++ print(check, ' Failed') ++ raise SystemExit(pipe.stderr.read().decode()) ++ ++ output = pipe.stdout.read() ++ output = output.decode() # get the str ++ opt = opt[-2:] ++ return [x.lstrip(opt) for x in output.split()] ++ ++ ++def createPcFile(PcFile): ++ print('creating %s' % PcFile) ++ with open(PcFile, 'w') as fo: ++ fo.write ("""\ ++prefix=%s ++ ++Name: Pycairo ++Description: Python 3 bindings for cairo ++Version: %s ++Requires: cairo ++Cflags: -I${prefix}/include/pycairo ++Libs: ++""" % (sys.prefix, pycairo_version) ++ ) ++ ++def createConfigFile(ConfigFile): ++ print('creating %s' % ConfigFile) ++ v = pycairo_version.split('.') ++ ++ with open(ConfigFile, 'w') as fo: ++ fo.write ("""\ ++// Configuration header created by setup.py - do not edit ++#ifndef _CONFIG_H ++#define _CONFIG_H 1 ++ ++#define PYCAIRO_VERSION_MAJOR %s ++#define PYCAIRO_VERSION_MINOR %s ++#define PYCAIRO_VERSION_MICRO %s ++#define VERSION "%s" ++ ++#endif // _CONFIG_H ++""" % (v[0], v[1], v[2], pycairo_version) ++ ) ++ ++ ++if sys.version_info < python_version_required: ++ raise SystemExit('Error: Python >= %s is required' % ++ (python_version_required,)) ++ ++pkg_config_version_check ('cairo', cairo_version_required) ++if sys.platform == 'win32': ++ runtime_library_dirs = [] ++else: ++ runtime_library_dirs = pkg_config_parse('--libs-only-L', 'cairo') ++ ++createPcFile(pkgconfig_file) ++createConfigFile(config_file) ++ ++ ++cairo = dic.Extension( ++ name = 'cairo._cairo', ++ sources = ['src/cairomodule.c', ++ 'src/context.c', ++ 'src/font.c', ++ 'src/matrix.c', ++ 'src/path.c', ++ 'src/pattern.c', ++ 'src/surface.c', ++ ], ++ include_dirs = pkg_config_parse('--cflags-only-I', 'cairo'), ++ library_dirs = pkg_config_parse('--libs-only-L', 'cairo'), ++ libraries = pkg_config_parse('--libs-only-l', 'cairo'), ++ runtime_library_dirs = runtime_library_dirs, ++ ) ++ ++dic.setup( ++ name = "pycairo", ++ version = pycairo_version, ++ description = "python interface for cairo", ++ ext_modules = [cairo], ++ package_dir = {'cairo': 'src'}, ++ packages = ['cairo'], ++ data_files = [ ++ ('include/pycairo', ['src/py3cairo.h']), ++ (LIBDIR + '/pkgconfig', [pkgconfig_file]), ++ (os.path.join(dsy.get_python_lib(True, False, prefix=sys.prefix), 'cairo'), ++ ['src/__init__.py']), ++ ], ++ ) diff --git a/programming/language/python3/python3-cairo/pspec.xml b/programming/language/python3/python3-cairo/pspec.xml index a187293f01..4d6e9ef735 100644 --- a/programming/language/python3/python3-cairo/pspec.xml +++ b/programming/language/python3/python3-cairo/pspec.xml @@ -18,7 +18,7 @@ cairo-devel - pycairo-1.10.0-waf-python3.4.patch + pycairo-setup.patch @@ -49,7 +49,7 @@ - 2017-02-01 + 2017-02-16 1.10.0 Release Bump Ayhan Yalçınsoy