borg/setup.py

81 lines
2.7 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
2013-07-08 21:38:27 +00:00
import attic
2011-11-06 20:40:29 +00:00
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-07-08 21:38:27 +00:00
print("Attic 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
2013-07-08 21:38:27 +00:00
chunker_source = 'attic/chunker.pyx'
hashindex_source = 'attic/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):
2013-07-08 21:38:27 +00:00
for src in glob('attic/*.pyx'):
cython_compiler.compile(glob('attic/*.pyx'),
2011-08-20 16:11:23 +00:00
cython_compiler.default_options)
sdist.__init__(self, *args, **kwargs)
2011-11-05 20:13:15 +00:00
def make_distribution(self):
2013-07-08 21:38:27 +00:00
self.filelist.extend(['attic/chunker.c', 'attic/_chunker.c', 'attic/hashindex.c', 'attic/_hashindex.c'])
2013-06-24 11:53:02 +00:00
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):
2013-07-08 21:38:27 +00:00
raise ImportError('The GIT version of attic needs Cython. Install Cython or use a released version')
2011-08-20 16:11:23 +00:00
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-07-08 21:38:27 +00:00
name='Attic',
version=attic.__release__,
2013-06-24 11:53:02 +00:00
author='Jonas Borgström',
author_email='jonas@borgstrom.se',
url='https://pythonhosted.org/Attic/',
2013-07-08 21:38:27 +00:00
description='Deduplicated backups',
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-07-28 12:55:48 +00:00
'Operating System :: POSIX :: BSD :: FreeBSD',
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-07-08 21:38:27 +00:00
packages=['attic', 'attic.testsuite'],
scripts=['scripts/attic'],
2013-06-24 11:53:02 +00:00
cmdclass={'build_ext': build_ext, 'sdist': Sdist},
ext_modules=[
2013-07-08 21:38:27 +00:00
Extension('attic.chunker', [chunker_source]),
Extension('attic.hashindex', [hashindex_source])
2013-06-24 11:53:02 +00:00
],
2013-06-27 11:28:59 +00:00
install_requires=['msgpack-python']
2013-06-24 11:53:02 +00:00
)