Commit Graph

490 Commits

Author SHA1 Message Date
Christoph Reiter d26442d853
Merge pull request #100 from danyeaw/fix-example-formatting
Fix formatting to PEP8
2018-02-22 09:23:51 +01:00
Dan Yeaw 3b4e189f56 Fix formatting to PEP8
Signed-off-by: Dan Yeaw <dan@yeaw.me>
2018-02-21 21:48:39 -05:00
Christoph Reiter 417c8afd8a version bump 2018-02-10 18:20:38 +01:00
Christoph Reiter c74dc1e358 release 2018-02-10 18:14:55 +01:00
Christoph Reiter cd8642d62f appveyor: pacman, yes to everything 2018-02-10 18:02:32 +01:00
Christoph Reiter 8965abb899 setup.py: don't include paths containing parts of the python library path, debian renames it after installation. See #98
Debian doesn't pass an alternative installation layout to setup.py but instead just renames
things afterwards. Since we now write relative paths containing the python library directory name
this breaks things and we can't do anything about it.

So instead of installing one header and referencing it from the other one just install it twice.
And reference the /usr/include one in the .pc file.
2018-02-10 17:49:50 +01:00
Christoph Reiter b04a67bb18 tests: add links to upstream pypy bugs for the remaining skipped tests 2018-02-07 17:07:44 +01:00
Christoph Reiter ff4c33f0fc travis-ci: try newer pypy releases 2018-02-07 16:50:36 +01:00
Christoph Reiter 0e3906005e tests: unskip test_fspaths under pypy
I can't reproduce the error any more, let's give it a try on CI
2018-02-07 16:38:52 +01:00
Christoph Reiter 95ecefd5b1 tests: fix offbyone in slice assignment, slowing things down
This made the array resize which is slow in PyPy
https://bitbucket.org/pypy/pypy/issues/2750

The test is still skipped as it now fails with
"TypeError: expected a writeable buffer object"
2018-02-07 15:20:54 +01:00
Christoph Reiter 23bc5cf6a9 version bump 2018-02-06 13:39:55 +01:00
Christoph Reiter ed67cc29d7 release 2018-02-06 13:38:20 +01:00
Christoph Reiter c9172639a7 setup.py: switch .pc file back to /usr/lib
We now have platform specific paths in the .pc file and can no longer
install it to /usr/share. Switch back to /usr/lib*.

The initial bug in jhbuild motivating the move is still there, so we
need to fix this in jhbuild.
2018-02-06 12:12:09 +01:00
Christoph Reiter 2a51f92dde version bump 2018-02-05 16:55:36 +01:00
Christoph Reiter fa1d76e06a release 2018-02-05 16:39:39 +01:00
Christoph Reiter f0fdcee0ac bump minor version
There are new files to install and new API.
2018-02-05 16:27:09 +01:00
Christoph Reiter 3fae55c9b6
Merge pull request #96 from lazka/get-include
Move header into the package and add a get_include() function
2018-01-31 22:33:07 +01:00
Christoph Reiter fa0707e565 Move header into the package and add a get_include() function. See #92
Pycairo installs .pc files which work quite well where the default
prefix is used, like with distro packaging etc. In virtualenvs
the pkg-config look up path needs to be set manually, and in pip
wheels are involved, where we had to disable installing .pc files
as they can get reused for a different prefix.

To make it easier for other python modules to use the C API introduce
a new function get_include() (similar ot what numpy has) which returns
the include path that needs to be passed to the compiler.

Since we can't really get the old header install path from the module
(one could walk up the tree and look for matching files, but that's ugly)
move the header file into the package itself, so that the path can be
dervived from the package path.

To prevent code from breaking which hardcodes the old include path
install a header to the old location which includes the new header
location.
2018-01-31 21:53:59 +01:00
Christoph Reiter 47aebd2073 version bump 2018-01-30 15:51:20 +01:00
Christoph Reiter 9249726375 release 2018-01-30 15:50:51 +01:00
Christoph Reiter 6cb1d2c148
Merge pull request #95 from lazka/travis-pypy3
travis-ci: add pypy3
2018-01-30 15:43:49 +01:00
Christoph Reiter 1ed20501f8 travis-ci: add pypy3 2018-01-30 15:38:04 +01:00
Christoph Reiter 8dfd3eb77c
Merge pull request #94 from lazka/remove-module-state
Remove use of PyState_FindModule. See #90
2018-01-30 15:24:14 +01:00
Christoph Reiter 5c2cfef838 Remove use of PyState_FindModule. See #90
Instead of using the module state API just import the module
end fetch the error type. This lets us get rid of the PyState API
which isn't available under PyPy3 and also reduces the difference
between Python 2 and 3.
2018-01-30 15:16:20 +01:00
Christoph Reiter c25c918512
Merge pull request #93 from lazka/pypy-support
Add basic PyPy support. See #90
2018-01-30 11:34:05 +01:00
Christoph Reiter 947f0055cf Add basic PyPy support. See #90
Use PyObject_GetAttrString() for accessing exception args as that works
on PyPy too.

Set tp_hash=PyObject_HashNotImplemented for some types, as PyPy doesn't
make them unhashable if tp_richcompare is set:
    https://bitbucket.org/pypy/pypy/issues/2740

Skip some tests due to:
    https://bitbucket.org/pypy/pypy/issues/2741
    https://bitbucket.org/pypy/pypy/issues/2742

Skip test_image_surface_create_for_data_array(), as it hangs.
And test_fspaths(). Needs investigating..
2018-01-30 10:42:40 +01:00
Christoph Reiter 54c268fe65 version bump 2018-01-29 11:42:57 +01:00
Christoph Reiter 83f8938a79 release 2018-01-29 11:42:20 +01:00
Christoph Reiter cd8f362819 appveyor: update setuptools for msvc build, hypothesis complains 2018-01-29 10:24:03 +01:00
Christoph Reiter 3bc49bdb40 appveyor: update the system before testing
We want to test against a newer cairo version
2018-01-29 10:19:57 +01:00
Christoph Reiter e4d517f91b setup.py: set zip_safe=False
We install headers and pkg-config files. While the build system should
theoretically detect this, force it to be on the safe side.
2018-01-21 22:12:53 +01:00
Christoph Reiter e59ce74ac7 setup.py: add headers as dependencies
this makes it rebuild if one of the header files is changed
2018-01-21 22:06:40 +01:00
Christoph Reiter 6e14bbf621 setup.py: get rid of config.h
Just pass the macros at compile time.
2018-01-21 22:05:11 +01:00
Christoph Reiter 75044e6f0c setup.py: Don't include the pkg-config file when building wheels. See #83
This just creates problems, so just skip it.
2018-01-01 11:49:22 +01:00
Christoph Reiter ebad4e1e38
Merge pull request #87 from lazka/new-path-encoding
Use utf-8 as path encoding for cairo >= 1.15.10. Fixes #86
2017-12-30 18:52:57 +01:00
Christoph Reiter 4e4bfe66e7 Use utf-8 as path encoding for cairo >= 1.15.10. Fixes #86
With https://cgit.freedesktop.org/cairo/commit/?id=84fc0ce91d1a57d20500f710abc0e17de82c67df
cairo has moved from using fopen, which supports ANSI paths, to _wfopen, which
supports all Windows paths. The input is changed/limited to utf-8.

To paper over this "API break" (anything outside of ASCII is different)
adjust the encoding based on the cairo library version at runtime.
2017-12-30 18:24:32 +01:00
Christoph Reiter 469c84ecd0 docs: add faq entry about broken .pc files due to python wheels 2017-12-11 10:55:37 +01:00
Christoph Reiter 1d2c452ce2 Rename codecov.yml
The alternative name works now
2017-12-06 15:36:12 +01:00
Christoph Reiter 3c937b07c6
Merge pull request #84 from lazka/bdist-wheel-warning
setup.py: Show a warning regarding pkgconfig paths when running bdist_wheel. Fixes #83
2017-11-28 11:43:33 +01:00
Christoph Reiter c0311444c6 setup.py: Show a warning regarding pkgconfig paths when running bdist_wheel. Fixes #83 2017-11-28 11:15:26 +01:00
Christoph Reiter f589c95607 version bump 2017-11-08 13:42:49 +01:00
Christoph Reiter 88478f2bb1 release 2017-11-08 13:42:16 +01:00
Christoph Reiter 6f8989ea36
Merge pull request #81 from lazka/enum-type-cast
Enum type cast
2017-11-08 08:12:42 +01:00
Christoph Reiter fac2acf1ed enums: ensure that enum values passed in match the ones passed back out
When taking enum values from Python we cast the signed values to the
enum type, which in case the enum type is unsigned leads to a defined
overflow.

When going the opposite way and creating Python enum values from
C enum values we have to do the reverse. Since casts from unsigned int
to signed int are undefined for > INT_MAX we need to do the type
conversion manually.
2017-11-07 23:01:57 +01:00
Christoph Reiter 074f0b24b8 enums: Don't assume enums are int when parsing Python args.
Instead cast the parsed int explicitly to the enum type which
might be unsigned.

Still not perfect, as the enum type can be smaller, but I don't
think any compiler does that.
2017-11-07 23:01:36 +01:00
Christoph Reiter 28e54d8cd1 flake8: skip new error 2017-11-07 15:40:37 +01:00
Christoph Reiter e502120e4b
Merge pull request #80 from trofi/master
cairo/context.c: preserve signedness in cairo_{get,set}_operator
2017-11-07 14:49:50 +01:00
Sergei Trofimovich aae1e28f09 cairo/context.c: preserve signedness in cairo_{get,set}_operator
I've noticed the failure [1] on big-endian powerpc64 and
little-endian amd64 using python2.

The failure is simple here:
    E       assert 4294967295 == -1
means the ollowing:
  cairo_set_operator(-1)
  cairo_get_operator() = 4294967295

which is the same 'int' value in signed and unsigned forms.
The cast from 'signed' to 'unsigned' happens in
    cairo_set_operator(-1)
in PyArg_ParseTuple (as python2 has no unsigned integral types).

The change amends 'cairo_get_operator' to account for
signedness flip and makes tests pass on powerpc64.

[1]:
```
================ FAILURES =============
______ test_context_get_set_operator __

    @given(integers())
>   def test_context_get_set_operator(value):

tests/test_hypothesis.py:183:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib64/python2.7/site-packages/hypothesis/core.py:524: in wrapped_test
    print_example=True, is_final=True
/usr/lib64/python2.7/site-packages/hypothesis/executors.py:58: in default_new_style_executor
    return function(data)
/usr/lib64/python2.7/site-packages/hypothesis/core.py:111: in run
    return test(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

value = -1

    @given(integers())
    def test_context_get_set_operator(value):
        try:
            op = cairo.Operator(value)
        except OverflowError:
            return

        surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10)
        context = cairo.Context(surface)
        try:
            context.set_operator(op)
        except OverflowError:
            return
>       assert context.get_operator() == op
E       assert 4294967295 == -1
E        +  where 4294967295 = <built-in method get_operator of cairo.Context object at 0x3fff88a9d0d0>()
E        +    where <built-in method get_operator of cairo.Context object at 0x3fff88a9d0d0> = <cairo.Context object at 0x3fff88a9d0d0>.get_operator

tests/test_hypothesis.py:195: AssertionError
---------------- Hypothesis -----------
Falsifying example: test_context_get_set_operator(value=-1)
================ 1 failed, 258 passed, 1 skipped in 9.76 seconds
```

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2017-10-29 19:50:57 +00:00
Christoph Reiter 5888659ca3 travis: grrr^2 2017-10-15 22:10:55 +02:00
Christoph Reiter 1cf4c83eb6 grrr 2017-10-15 21:37:45 +02:00