borg/setup.py

80 lines
2.6 KiB
Python
Raw Normal View History

2010-02-28 19:22:45 +00:00
# -*- encoding: utf-8 *-*
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-06 20:40:29 +00:00
import darc
2013-06-03 11:45:48 +00:00
min_python = (3, 2)
2011-11-06 20:40:29 +00:00
if sys.version_info < min_python:
2013-06-03 11:45:48 +00:00
print("Darc requires Python %d.%d or later" % min_python)
2011-11-06 20:40:29 +00:00
sys.exit(1)
2011-11-05 20:13:15 +00:00
2013-06-27 11:28:59 +00:00
try:
from setuptools import setup, Extension
except ImportError:
2013-06-27 20:48:49 +00:00
from distutils.core import setup, Extension
from distutils.command.sdist import sdist
2010-02-28 19:22:45 +00:00
chunker_source = 'darc/chunker.pyx'
hashindex_source = 'darc/hashindex.pyx'
2011-08-20 16:11:23 +00:00
try:
from Cython.Distutils import build_ext
import Cython.Compiler.Main as cython_compiler
2011-11-06 20:40:29 +00:00
2011-08-20 16:11:23 +00:00
class Sdist(sdist):
def __init__(self, *args, **kwargs):
for src in glob('darc/*.pyx'):
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):
2013-06-24 11:53:02 +00:00
self.filelist.extend(['darc/chunker.c', 'darc/_chunker.c', 'darc/hashindex.c', 'darc/_hashindex.c'])
super(Sdist, self).make_distribution()
2011-08-20 16:11:23 +00:00
except ImportError:
2013-06-24 11:53:02 +00:00
class Sdist(sdist):
def __init__(self, *args, **kwargs):
raise Exception('Cython is required to run sdist')
chunker_source = chunker_source.replace('.pyx', '.c')
hashindex_source = hashindex_source.replace('.pyx', '.c')
from distutils.command.build_ext import build_ext
if not os.path.exists(chunker_source) or not os.path.exists(hashindex_source):
2011-08-20 16:11:23 +00:00
raise ImportError('The GIT version of darc needs Cython. Install Cython or use a released version')
2013-07-05 10:32:56 +00:00
with open('README.rst', 'r') as fd:
long_description = fd.read()
2013-06-24 11:53:02 +00:00
setup(
2013-06-27 20:48:49 +00:00
name='darc',
2013-06-25 10:39:22 +00:00
version=darc.__release__,
2013-06-24 11:53:02 +00:00
author='Jonas Borgström',
author_email='jonas@borgstrom.se',
url='http://github.com/jborg/darc/',
description='Deduplicating ARChiver written in Python',
2013-07-05 10:32:56 +00:00
long_description=long_description,
2013-06-24 11:53:02 +00:00
license='BSD',
2013-06-27 20:10:15 +00:00
platforms=['Linux', 'MacOS X'],
2013-06-24 11:53:02 +00:00
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: BSD License',
2013-06-27 20:10:15 +00:00
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux',
2013-06-24 11:53:02 +00:00
'Programming Language :: Python',
'Topic :: Security :: Cryptography',
'Topic :: System :: Archiving :: Backup',
],
2013-06-24 20:41:05 +00:00
packages=['darc', 'darc.testsuite'],
2013-06-24 11:53:02 +00:00
scripts=['scripts/darc'],
cmdclass={'build_ext': build_ext, 'sdist': Sdist},
ext_modules=[
Extension('darc.chunker', [chunker_source]),
Extension('darc.hashindex', [hashindex_source])
],
2013-06-27 11:28:59 +00:00
install_requires=['msgpack-python']
2013-06-24 11:53:02 +00:00
)