bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.17.1
by Robert Collins
Starting point. Interface tests hooked up and failing. |
1 |
#!/usr/bin/env python
|
|
0.19.1
by Robert Collins
Start to simplify flush_range. |
2 |
import os |
|
0.17.1
by Robert Collins
Starting point. Interface tests hooked up and failing. |
3 |
from distutils.core import setup |
4 |
||
5 |
bzr_plugin_name = 'groupcompress' |
|
6 |
||
7 |
bzr_plugin_version = (1, 6, 0, 'dev', 0) |
|
8 |
||
|
0.18.1
by John Arbash Meinel
Start working on an EquivalenceTable construct. |
9 |
from distutils import log |
10 |
from distutils.errors import CCompilerError, DistutilsPlatformError |
|
11 |
from distutils.extension import Extension |
|
12 |
ext_modules = [] |
|
13 |
try: |
|
14 |
from Pyrex.Distutils import build_ext |
|
15 |
except ImportError: |
|
16 |
have_pyrex = False |
|
17 |
# try to build the extension from the prior generated source.
|
|
18 |
print
|
|
19 |
print ("The python package 'Pyrex' is not available." |
|
20 |
" If the .c files are available,") |
|
21 |
print ("they will be built," |
|
22 |
" but modifying the .pyx files will not rebuild them.") |
|
23 |
print
|
|
24 |
from distutils.command.build_ext import build_ext |
|
25 |
else: |
|
26 |
have_pyrex = True |
|
27 |
||
28 |
||
29 |
class build_ext_if_possible(build_ext): |
|
30 |
||
31 |
def run(self): |
|
32 |
try: |
|
33 |
build_ext.run(self) |
|
34 |
except DistutilsPlatformError, e: |
|
35 |
log.warn(str(e)) |
|
36 |
log.warn('Extensions cannot be built, ' |
|
37 |
'will use the Python versions instead') |
|
38 |
||
39 |
def build_extension(self, ext): |
|
40 |
try: |
|
41 |
build_ext.build_extension(self, ext) |
|
42 |
except CCompilerError: |
|
43 |
log.warn('Building of "%s" extension failed, ' |
|
44 |
'will use the Python version instead' % (ext.name,)) |
|
45 |
||
46 |
||
47 |
# Override the build_ext if we have Pyrex available
|
|
48 |
unavailable_files = [] |
|
49 |
||
50 |
||
51 |
def add_pyrex_extension(module_name, **kwargs): |
|
52 |
"""Add a pyrex module to build. |
|
53 |
||
54 |
This will use Pyrex to auto-generate the .c file if it is available.
|
|
55 |
Otherwise it will fall back on the .c file. If the .c file is not
|
|
56 |
available, it will warn, and not add anything.
|
|
57 |
||
58 |
You can pass any extra options to Extension through kwargs. One example is
|
|
59 |
'libraries = []'.
|
|
60 |
||
61 |
:param module_name: The python path to the module. This will be used to
|
|
62 |
determine the .pyx and .c files to use.
|
|
63 |
"""
|
|
64 |
path = module_name.replace('.', '/') |
|
65 |
pyrex_name = path + '.pyx' |
|
66 |
c_name = path + '.c' |
|
67 |
# Manually honour package_dir :(
|
|
68 |
module_name = 'bzrlib.plugins.groupcompress.' + module_name |
|
69 |
if have_pyrex: |
|
70 |
ext_modules.append(Extension(module_name, [pyrex_name])) |
|
71 |
else: |
|
72 |
if not os.path.isfile(c_name): |
|
73 |
unavailable_files.append(c_name) |
|
74 |
else: |
|
75 |
ext_modules.append(Extension(module_name, [c_name])) |
|
|
0.19.1
by Robert Collins
Start to simplify flush_range. |
76 |
|
|
0.18.13
by John Arbash Meinel
Copy the EquivalenceTable code into pyrex and get it under test. |
77 |
add_pyrex_extension('_groupcompress_c') |
|
0.19.1
by Robert Collins
Start to simplify flush_range. |
78 |
|
|
0.17.1
by Robert Collins
Starting point. Interface tests hooked up and failing. |
79 |
|
80 |
if __name__ == '__main__': |
|
81 |
setup(name="bzr groupcompress", |
|
82 |
version="1.6.0dev0", |
|
83 |
description="bzr group compression.", |
|
84 |
author="Robert Collins", |
|
85 |
author_email="bazaar@lists.canonical.com", |
|
86 |
license = "GNU GPL v2", |
|
87 |
url="https://launchpad.net/bzr-groupcompress", |
|
88 |
packages=['bzrlib.plugins.groupcompress', |
|
89 |
'bzrlib.plugins.groupcompress.tests', |
|
90 |
],
|
|
91 |
package_dir={'bzrlib.plugins.groupcompress': '.'}, |
|
|
0.19.1
by Robert Collins
Start to simplify flush_range. |
92 |
cmdclass={'build_ext': build_ext_if_possible}, |
93 |
ext_modules=ext_modules, |
|
|
0.18.13
by John Arbash Meinel
Copy the EquivalenceTable code into pyrex and get it under test. |
94 |
)
|