borg/setup.py

62 lines
1.9 KiB
Python
Raw Normal View History

2010-02-28 19:22:45 +00:00
# -*- encoding: utf-8 *-*
#!/usr/bin/env python
2011-08-20 16:11:23 +00:00
import os
2010-10-30 11:24:23 +00:00
import sys
2011-08-20 16:11:23 +00:00
from glob import glob
2011-11-05 20:13:15 +00:00
try:
import Cython
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "fake_pyrex"))
except ImportError:
pass
2010-10-15 18:46:17 +00:00
from setuptools import setup, Extension
2011-08-20 16:11:23 +00:00
from setuptools.command.sdist import sdist
hashindex_sources = ['darc/hashindex.pyx', 'darc/_hashindex.c']
2010-02-28 19:22:45 +00:00
2011-08-20 16:11:23 +00:00
try:
from Cython.Distutils import build_ext
import Cython.Compiler.Main as cython_compiler
class Sdist(sdist):
def __init__(self, *args, **kwargs):
for src in glob('darc/*.pyx'):
print 'src', src
cython_compiler.compile(glob('darc/*.pyx'),
cython_compiler.default_options)
sdist.__init__(self, *args, **kwargs)
2011-11-05 20:13:15 +00:00
def make_distribution(self):
self.filelist.append('darc/hashindex.c')
self.filelist.append('darc/hashindex.h')
sdist.make_distribution(self)
2011-08-20 16:11:23 +00:00
except ImportError:
hashindex_sources[0] = hashindex_sources[0].replace('.pyx', '.c')
from setuptools.command.build_ext import build_ext
Sdist = sdist
if not os.path.exists('darc/hashindex.c'):
raise ImportError('The GIT version of darc needs Cython. Install Cython or use a released version')
dependencies = ['pycrypto', 'msgpack-python', 'pbkdf2.py', 'xattr', 'paramiko']
2010-10-30 11:24:23 +00:00
if sys.version_info < (2, 7):
dependencies.append('argparse')
2010-10-27 18:12:40 +00:00
setup(name='darc',
2010-10-15 18:46:17 +00:00
version='0.1',
2011-06-23 20:49:16 +00:00
author='Jonas Borgström',
2010-02-28 19:22:45 +00:00
author_email='jonas@borgstrom.se',
2011-08-20 16:11:23 +00:00
url='http://github.com/jborg/darc/',
2010-10-27 18:12:40 +00:00
packages=['darc'],
2011-08-20 16:11:23 +00:00
cmdclass = {'build_ext': build_ext, 'sdist': Sdist},
2010-12-16 19:23:22 +00:00
ext_modules=[
Extension('darc._speedups', ['darc/_speedups.c']),
2011-08-20 16:11:23 +00:00
Extension('darc.hashindex', hashindex_sources)],
2010-10-30 11:24:23 +00:00
install_requires=dependencies,
2010-10-15 18:46:17 +00:00
entry_points = {
'console_scripts': [
2010-10-27 18:12:40 +00:00
'darc = darc.archiver:main',
2010-10-15 18:46:17 +00:00
]
})
2010-04-18 20:08:12 +00:00