Packaging improvements

This commit is contained in:
Jonas Borgström 2013-06-24 13:53:02 +02:00
parent 2f3489e989
commit 8a2f555c68
10 changed files with 72 additions and 37 deletions

2
.gitignore vendored
View File

@ -1,7 +1,9 @@
MANIFEST
docs/_build
build
dist
env
.tox
hashindex.c
chunker.c
*.egg-info

28
COPYING Normal file
View File

@ -0,0 +1,28 @@
Copyright (C) 2010-2013 Jonas Borgström <jonas@borgstrom.se>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,4 +1,3 @@
# This is a python package
__version__ = '0.5'
__release__ = __version__ + 'dev'
__version__ = '0.6dev'

View File

@ -1 +0,0 @@
# This is a python package

View File

@ -1,6 +0,0 @@
from distutils.command.build_ext import build_ext
#
#def build_ext(*args, **kw):
# from distutils import build_ext as build_ext_orig
# return build_ext_orig(*args, **kw)

View File

@ -1 +0,0 @@
# This is a python package

View File

@ -1 +0,0 @@
This workaround is needed for setuptools to work properly with Cython when Pyrex isn't installed.

View File

@ -1,2 +0,0 @@
[egg_info]
tag_build = dev

View File

@ -10,14 +10,9 @@ if sys.version_info < min_python:
print("Darc requires Python %d.%d or later" % min_python)
sys.exit(1)
try:
import Cython
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "fake_pyrex"))
except ImportError:
pass
from distutils.core import setup
from distutils.extension import Extension
#from distutils.core import setup
#from distutils.extension import Extension
from setuptools import setup, Extension
from distutils.command.sdist import sdist
chunker_source = 'darc/chunker.pyx'
@ -35,27 +30,44 @@ try:
sdist.__init__(self, *args, **kwargs)
def make_distribution(self):
self.filelist += ['darc/chunker.c', 'darc/chunker.h', 'darc/hashindex.c', 'darc/hashindex.h']
sdist.make_distribution(self)
self.filelist.extend(['darc/chunker.c', 'darc/_chunker.c', 'darc/hashindex.c', 'darc/_hashindex.c'])
super(Sdist, self).make_distribution()
except ImportError:
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
Sdist = sdist
if not os.path.exists(chunker_source) or not os.path.exists(hashindex_source):
raise ImportError('The GIT version of darc needs Cython. Install Cython or use a released version')
setup(name='darc',
version=darc.__version__,
author='Jonas Borgström',
author_email='jonas@borgstrom.se',
url='http://github.com/jborg/darc/',
packages=['darc'],
cmdclass={'build_ext': build_ext, 'sdist': Sdist},
ext_modules=[
Extension('darc.chunker', [chunker_source]),
Extension('darc.hashindex', [hashindex_source])],
scripts=['scripts/darc'],
)
setup(
name='Darc',
version=darc.__version__,
author='Jonas Borgström',
author_email='jonas@borgstrom.se',
url='http://github.com/jborg/darc/',
description='Deduplicating ARChiver written in Python',
license='BSD',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX',
'Programming Language :: Python',
'Topic :: Security :: Cryptography',
'Topic :: System :: Archiving :: Backup',
],
packages=['darc'],
scripts=['scripts/darc'],
cmdclass={'build_ext': build_ext, 'sdist': Sdist},
ext_modules=[
Extension('darc.chunker', [chunker_source]),
Extension('darc.hashindex', [hashindex_source])
],
install_requires=['msgpack-python', 'pyxattr']
)

5
tox.ini Normal file
View File

@ -0,0 +1,5 @@
[tox]
envlist = py32, py33
[testenv]
commands = fakeroot {envpython} -m darc.test