Skip to content

Commit

Permalink
Pycairo 1.8.8 release
Browse files Browse the repository at this point in the history
Create config.h in 'src' dir. Unify the 3 install methods so they all use
config.h to get version info.
  • Loading branch information
Steve Chaplin authored and lazka committed Apr 6, 2017
1 parent 453ebef commit c01a43c
Show file tree
Hide file tree
Showing 18 changed files with 155 additions and 144 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,6 +8,7 @@
aclocal.m4
autom4te.cache
autoscan.log
build
config.cache
config.h
config.h.in
Expand Down
36 changes: 18 additions & 18 deletions INSTALL
@@ -1,31 +1,31 @@
GNU Autotools - install method 1 - preferred method
--------------------------------
Waf - recommended install method
---
$ ./waf --help # shows available waf options
$ ./waf configure
$ ./waf build
$ ./waf install


GNU Autotools - alternative install method
-------------
Using the same install method of install as cairo - GNU autotools.

$ python -c "import sys; print sys.prefix"
# make a note of the python prefix
$ ./configure --prefix=<python_prefix>
$ make
$ make install # may require superuser access
$ python -c "import sys; print sys.prefix"
# make a note of the python prefix
$ ./configure --prefix=<python_prefix>
$ make
$ make install # may require superuser access

To build from CVS, use this line instead of the configure line above:
$ ./autogen.sh --prefix=<python_prefix>
$ ./autogen.sh --prefix=<python_prefix>

If you're installing to another prefix than the one where Python is installed
Python will not be able to find the cairo module until you add
$prefix/lib/pythonX.Y/site-packages to the PYTHONPATH variable.


Waf - install method 2 - alternative install method
----------------------
$ ./waf --help # shows available waf options
$ ./waf configure
$ ./waf build
$ ./waf install


Python distutils - install method 3 - alternative install method
-----------------------------------
Python distutils - alternative install method
----------------
$ python setup.py install


Expand Down
1 change: 0 additions & 1 deletion Makefile.am
Expand Up @@ -59,7 +59,6 @@ release-upload: release-check $(tar_file) $(md5_file)
scp $(tar_file) $(md5_file) $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR)
mv $(tar_file) $(md5_file) releases
ssh $(RELEASE_UPLOAD_HOST) "rm -f $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-[0-9]* && ln -s $(tar_file) $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-$(VERSION)"
cvs tag RELEASE_$(PYCAIRO_VERSION_MAJOR)_$(PYCAIRO_VERSION_MINOR)_$(PYCAIRO_VERSION_MICRO)

release-publish: release-upload releases/$(md5_file)
@echo ""
Expand Down
11 changes: 11 additions & 0 deletions NEWS
@@ -1,3 +1,14 @@
Overview of changes from pycairo 1.8.6 to pycairo 1.8.8
=======================================================
General Changes:
Pycairo 1.8.8 requires cairo 1.8.8 (or later).
Move from CVS to git.
Add support for the waf build tool.

Updated methods
The PDF/PS/SVGSurface constructors now accept None as a filename.


Overview of changes from pycairo 1.8.4 to pycairo 1.8.6
=======================================================
General Changes:
Expand Down
2 changes: 1 addition & 1 deletion README
Expand Up @@ -3,7 +3,7 @@ http://www.cairographics.org/pycairo

Dependencies
------------
cairo >= 1.8.6
cairo >= 1.8.8
Python >= 2.6

Compiling
Expand Down
69 changes: 30 additions & 39 deletions RELEASING
@@ -1,50 +1,42 @@
Here are the steps to follow to create a new pycairo release:

1) Ensure that there are no local, uncommitted modifications. The best
thing to do here may be to begin with a fresh checkout from CVS:
1) Fill out an entry in the NEWS file
Sift through the information in 'git log' since the last release. Summarize
major changes briefly in a style similar to other entries in NEWS.

cvs -d cairographics.org:/cvs/cairo co pycairo

But it's probably good enough if "cvs -q update -Ad" generates no
output.

2) Fill out an entry in the NEWS file

Sift through the information in ChangeLog since the last release. Summarize
major changes briefly in a style similar to other entries in NEWS.

3) Increment version numbers in:
cairo/cairomodule.c
configure.ac
doc/conf.py
README
setup.py

Increment pycairo_major/minor/micro_version in configure.ac
Increase the cairo_required_version - to an even numbered version.
Increment pycairo_major/minor version to match the cairo major/minor
version that pycairo requires (and increment the micro version if
necessary for any subsequent pycairo updates).

(install fresh copy, run examples, run any other tests)
2) Increment pycairo version number in:
configure.ac
doc/conf.py
README
setup.py
wscript

4) Commit the changes to NEWS, configure.ac etc
Increment pycairo_major/minor/micro_version in configure.ac
Increase the cairo_required_version - to an even numbered version.
Increment pycairo_major/minor version to match the cairo major/minor
version that pycairo requires (and increment the micro version if
necessary for any subsequent pycairo updates).

Don't forget to fill out the ChangeLog just like with any other commit.
It's especially important to mention the new version number in the
ChangeLog.
Add a '=== Pycairo x.x.x ===' header to ChangeLog
Do "cvs -q update -Ad" to confirm there are no uncommitted changes.
(install fresh copy, run tests and examples)

5) Run "make distcheck" and verify that it gives in no warnings or errors and
3) Run "make distcheck" and verify that it gives in no warnings or errors and
ends with a message of the form:

===============================================
pycairo-X.Y.Z archives ready for distribution:
pycairo-X.Y.Z.tar.gz
===============================================

6) Edit Makefile.am and select either 'snapshot' or 'release'.
4) Commit the changes to NEWS, configure.ac etc
It's especially important to mention the new version number in the git commit
comment.
Add a '=== Pycairo x.x.x ===' header.

$ git tag v 1.x.x

push the changes to the freedesktop server.

5) Edit Makefile.am and select either 'snapshot' or 'release'.
Run "make release-publish" which will perform the following steps for you:

* Check that the version number ends with an even micro component
Expand All @@ -55,22 +47,21 @@ Here are the steps to follow to create a new pycairo release:
* scp both files to appear on http://cairographics.org/releases
* Place local copies of the files in the releases directory
* Create a LATEST-package-version file (after deleting any old one)
* Tag the entire source tree with a tag of the form RELEASE_X_Y_Z
* Provide some text for the release announcement (see below).

7) Verify that the tar file arrived at the website.
6) Verify that the tar file arrived at the website.
Check tar file has read permissions for all.
Update the pycairo webpage to reference the new release.
Update http://cheeseshop.python.org entry for pycairo.

8) Edit:
cairo/cairomodule.c
7) Edit:
configure.ac
setup.py
wscript
to increment pycairo_version_micro to the next larger (odd) number and
commit.

9) Send a message to cairo-announce@cairographics.org
8) Send a message to cairo-announce@cairographics.org
and CC python-announce-list@python.org
to announce the new release using the text provided from
"make release-publish".
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Expand Up @@ -4,7 +4,7 @@ AC_PREREQ(2.59)
# the pycairo version number
m4_define(pycairo_version_major, 1)
m4_define(pycairo_version_minor, 8)
m4_define(pycairo_version_micro, 7)
m4_define(pycairo_version_micro, 8)
m4_define(pycairo_version, pycairo_version_major.pycairo_version_minor.pycairo_version_micro)

# versions of packages we require
Expand All @@ -19,7 +19,7 @@ AC_DEFINE(PYCAIRO_VERSION_MINOR, pycairo_version_minor, [pycairo minor version])
AC_DEFINE(PYCAIRO_VERSION_MICRO, pycairo_version_micro, [pycairo macro version])

AC_CONFIG_SRCDIR([src/pycairo.h])
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_HEADERS(src/config.h)

AM_INIT_AUTOMAKE([1.9.6 -Wall])

Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Expand Up @@ -48,7 +48,7 @@
# The short X.Y version.
version = '1.8'
# The full version, including alpha/beta/rc tags.
release = '1.8.6'
release = '1.8.8'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
136 changes: 81 additions & 55 deletions setup.py
Expand Up @@ -3,48 +3,43 @@
import distutils.core as dic
import distutils.dir_util as dut
import distutils.file_util as fut
import io
import subprocess
import sys

pycairo_version = '1.8.7'
cairo_version_required = '1.8.6'
pycairo_version = '1.8.8'
cairo_version_required = '1.8.8'
pkgconfig_file = 'pycairo.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
pipe = subprocess.Popen(command, shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
pipe.wait()
return pipe

def pkg_config_version_check(pkg, version):
pipe = call('pkg-config --print-errors --exists "%s >= %s"' %
(pkg, version))
if pipe.returncode == 0:
print '%s >= %s detected' % (pkg, version)
else:
print pipe.stderr.read()
raise SystemExit('Error: %s >= %s not found' % (pkg, version))
pipe = call('pkg-config --print-errors --exists "%s >= %s"' %
(pkg, version))
if pipe.returncode == 0:
print '%s >= %s detected' % (pkg, version)
else:
print pipe.stderr.read()
raise SystemExit('Error: %s >= %s not found' % (pkg, version))

def pkg_config_parse(opt, pkg):
pipe = call("pkg-config %s %s" % (opt, pkg))
output = pipe.stdout.read()
opt = opt[-2:]
return [x.lstrip(opt) for x in output.split()]

pipe = call("pkg-config %s %s" % (opt, pkg))
output = pipe.stdout.read()
opt = opt[-2:]
return [x.lstrip(opt) for x in output.split()]

if sys.version_info < (2,6):
raise SystemExit('Error: Python >= 2.6 is 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')

pkgconfig_file='pycairo.pc'
print 'creating %s' % pkgconfig_file
fo = open (pkgconfig_file, 'w')
fo.write ("""\
def createPcFile(PcFile):
print 'creating %s' % PcFile
with open(PcFile, 'w') as fo:
fo.write ("""\
prefix=%s
Name: Pycairo
Expand All @@ -54,31 +49,62 @@ def pkg_config_parse(opt, pkg):
Cflags: -I${prefix}/include/pycairo
Libs:
""" % (sys.prefix, pycairo_version)
)
fo.close()
)

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 < (2,6):
raise SystemExit('Error: Python >= 2.6 is 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 = ['cairo/cairomodule.c',
'cairo/pycairo-context.c',
'cairo/pycairo-font.c',
'cairo/pycairo-matrix.c',
'cairo/pycairo-path.c',
'cairo/pycairo-pattern.c',
'cairo/pycairo-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,
)
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",
packages = ['cairo'],
ext_modules = [cairo],
data_files=[('include/pycairo',['cairo/pycairo.h']),
('lib/pkgconfig',[pkgconfig_file])],
)
name = "pycairo",
version = pycairo_version,
description = "python interface for cairo",
ext_modules = [cairo],
data_files=[('include/pycairo',['src/pycairo.h']),
('lib/pkgconfig',[pkgconfig_file])],
)
4 changes: 1 addition & 3 deletions src/cairomodule.c
Expand Up @@ -31,9 +31,7 @@
#define PY_SSIZE_T_CLEAN
#include <Python.h>

#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "config.h"
#include "private.h"

/* to read CAIRO_PS_LEVEL_* constants */
Expand Down

0 comments on commit c01a43c

Please sign in to comment.