[100265] trunk/dports/python
g5pw at macports.org
g5pw at macports.org
Wed Dec 5 22:45:07 PST 2012
Revision: 100265
https://trac.macports.org/changeset/100265
Author: g5pw at macports.org
Date: 2012-12-05 22:45:07 -0800 (Wed, 05 Dec 2012)
Log Message:
-----------
python/py-cairo:
- unified using python portgroup
- check for cairo variant using active_variants
- use setup.py install method
- new maintainer
Modified Paths:
--------------
trunk/dports/python/py-cairo/Portfile
Added Paths:
-----------
trunk/dports/python/py-cairo/files/
trunk/dports/python/py-cairo/files/setup.py.patch
Removed Paths:
-------------
trunk/dports/python/py25-cairo/
trunk/dports/python/py26-cairo/
trunk/dports/python/py27-cairo/
Modified: trunk/dports/python/py-cairo/Portfile
===================================================================
--- trunk/dports/python/py-cairo/Portfile 2012-12-06 05:40:57 UTC (rev 100264)
+++ trunk/dports/python/py-cairo/Portfile 2012-12-06 06:45:07 UTC (rev 100265)
@@ -1,65 +1,82 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8::et:sw=4:ts=4:sts=4
# $Id$
-PortSystem 1.0
+PortSystem 1.0
+PortGroup python 1.0
+PortGroup active_variants 1.0
-name py-cairo
-set my_name pycairo
-# pycairo 1.6.4 does not support Python 2.4
-version 1.4.12
-revision 5
-categories python x11
-license {LGPL-2.1 MPL-1.1}
-platforms darwin
-maintainers nomaintainer
-description Pycairo is set of Python bindings for the cairo graphics library
+name py-cairo
+set my_name pycairo
+version 1.10.0
+categories python x11
+license {LGPL-2.1 MPL-1.1}
+platforms darwin
+maintainers gmail.com:sean.michael.farley openmaintainer
+description Pycairo is set of Python bindings for the cairo graphics library
-long_description \
- ${description}
+long_description ${description}
-homepage http://cairographics.org/pycairo/
-master_sites http://cairographics.org/releases/
-distname ${my_name}-${version}
+homepage http://cairographics.org/pycairo/
+master_sites http://cairographics.org/releases/
-checksums md5 c63199d35b1e1d3c5133509f315f70d7 \
- sha1 580255db6f3ab4c44ac44dfe0a9f7d1f598c2ab3 \
- rmd160 f44bb6bcc6b366568e0297689164537dc891b278
+use_bzip2 yes
-depends_build port:pkgconfig
-depends_lib port:python24 \
- path:lib/pkgconfig/cairo.pc:cairo \
- port:libpng
+checksums rmd160 7d1c1c05113e5bbad32dbe96c65c918b170cac33 \
+ sha256 9aa4078e7eb5be583aeabbe8d87172797717f95e8c4338f0d4a17b683a7253be
-# depends_test
-depends_build-append port:py24-numpy
+python.versions 26 27 31 32 33
+python.default_version 27
-configure.python ${prefix}/bin/python2.4
+depends_build port:pkgconfig
+depends_lib path:lib/pkgconfig/cairo.pc:cairo
-set python_prefix ${frameworks_dir}/Python.framework/Versions/2.4
-# change default includedir to avoid conflict with other python pycairo packages
-configure.args-append --includedir=${prefix}/include/python2.4
+patchfiles-append setup.py.patch
-platform darwin 9 {
- post-patch {
- reinplace "s| -export-symbols-regex.*||g" ${worksrcpath}/cairo/Makefile.in
- }
-}
+if {${name} != ${subport}} {
+ depends_build-append port:py${python.version}-numpy
-post-destroot {
- set docdir ${prefix}/share/doc/${name}-${version}
- xinstall -d ${destroot}${docdir}
- xinstall -m 0644 -W ${worksrcpath} AUTHORS COPYING NEWS doc/NOTES doc/FAQ README \
- ${destroot}${docdir}
+ # pycairo distributes python 2.x versions as py2cairo
+ if {${python.version} < 31} {
+ set my_name py2cairo
- # avoid conflict with other python pycairo packages
- # pkg-config based ports will have to set configure.pkg_config_path to find this package
- xinstall -d -m 0755 ${destroot}${python_prefix}/lib
- move ${destroot}${prefix}/lib/pkgconfig ${destroot}${python_prefix}/lib
+ checksums rmd160 ce75db9af32ef1a3e90f6aaa649cbb2493a941a4 \
+ sha256 d30439f06c2ec1a39e27464c6c828b6eface3b22ee17b2de05dc409e429a7431
+
+ post-patch {
+ reinplace "s|py3cairo|pycairo|g" ${worksrcpath}/setup.py
+ }
+ }
+
+ distname ${my_name}-${version}
+
+ livecheck.type none
+} else {
+ livecheck.type regex
+ livecheck.regex "${my_name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
}
-post-patch { reinplace "s/python /python2.4 /" ${worksrcpath}/test/test.test }
-test.run yes
-test.cmd "cd test && python2.4"
-test.target test.py
+post-configure {
+ if {[variant_isset x11]} {
+ require_active_variants cairo x11
+ }
+}
-livecheck.type regex
-livecheck.regex ${my_name}-(1\\.4\\.\\d+)
+platform darwin 9 {
+ post-patch {
+ reinplace "s| -export-symbols-regex.*||g" ${worksrcpath}/cairo/Makefile.in
+ }
+}
+
+post-extract {
+ fs-traverse item ${worksrcpath} {
+ if {[file isdirectory ${item}]} {
+ file attributes ${item} -permissions a+rx
+ } elseif {[file isfile ${item}]} {
+ file attributes ${item} -permissions a+r
+ }
+ }
+}
+
+variant x11 {}
+
+default_variants +x11
Added: trunk/dports/python/py-cairo/files/setup.py.patch
===================================================================
--- trunk/dports/python/py-cairo/files/setup.py.patch (rev 0)
+++ trunk/dports/python/py-cairo/files/setup.py.patch 2012-12-06 06:45:07 UTC (rev 100265)
@@ -0,0 +1,127 @@
+--- setup.py 2012-09-02 21:20:12.000000000 -0500
++++ setup.py.new 2012-09-02 21:19:23.000000000 -0500
+@@ -0,0 +1,124 @@
++#!/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.2'
++python_version_required = (2,6)
++pkgconfig_file = 'py3cairo.pc'
++config_file = 'src/config.h'
++
++
++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_MICRO %s
++#define PYCAIRO_VERSION_MINOR %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],
++ data_files = [
++ ('include/pycairo', ['src/py3cairo.h']),
++ ('lib/pkgconfig', [pkgconfig_file]),
++ (os.path.join(dsy.get_python_lib(), 'cairo'),
++ ['src/__init__.py']),
++ ],
++ )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20121205/54c7b132/attachment.html>
More information about the macports-changes
mailing list