debian packaging

This commit is contained in:
Benjamin Dauvergne 2014-10-13 23:24:18 +02:00
parent 5cfbfe5b83
commit 6fc09e500d
8 changed files with 128 additions and 3 deletions

View File

@ -4,3 +4,5 @@ include README.rst
recursive-include import_export/templates *
recursive-include import_export/locale *
recursive-include import_export/static *
include VERSION
include MANIFEST.in

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
django-import-export (0.2.4-0) unstable; urgency=low
* Initial packaging
-- Benjamin Dauvergne <bdauvergne@entrouvert.com> Thu, 13 Oct 2014 23:22:57 +0200

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

18
debian/control vendored Normal file
View File

@ -0,0 +1,18 @@
Source: django-import-export
Maintainer: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Section: python
Priority: optional
Build-Depends: python-setuptools, python-all, python3-setuptools, python3-all, debhelper (>= 9), dh-python
Standards-Version: 3.9.1
Package: python-django-import-export
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}
Description: Django application and library for importing and exporting data
with included admin integration.
Package: python3-django-import-export
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}
Description: Django application and library for importing and exporting data
with included admin integration.

7
debian/rules vendored Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/make -f
export PYBUILD_DISABLE=test
export PYBUILD_NAME=django-import-export
%:
dh $@ --with python2,python3 --buildsystem=pybuild

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

1
debian/source/options vendored Normal file
View File

@ -0,0 +1 @@
extend-diff-ignore="\.egg-info"

View File

@ -1,7 +1,91 @@
import os
import subprocess
import sys
from setuptools import find_packages, setup
from setuptools.command.install_lib import install_lib as _install_lib
from distutils.command.build import build as _build
from distutils.command.sdist import sdist
from distutils.cmd import Command
VERSION = __import__("import_export").__version__
def get_version():
'''Use the VERSION, if absent generates a version with git describe, if not
tag exists, take 0.0- and add the length of the commit log.
'''
if os.path.exists('VERSION'):
with open('VERSION', 'r') as v:
return v.read()
if os.path.exists('.git'):
p = subprocess.Popen(
['git', 'describe', '--dirty=.dirty', '--match=*'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = p.communicate()[0]
if p.returncode == 0:
result = result.decode('ascii').strip() # strip spaces/newlines and initial v
if '-' in result: # not a tagged version
real_number, commit_count, commit_hash = result.split('-', 2)
version = '%s.post%s+%s' % (real_number, commit_count, commit_hash)
else:
version = result
return version
else:
return '0.0.post%s' % len(
subprocess.check_output(
['git', 'rev-list', 'HEAD']).splitlines())
return '0.0'
class compile_translations(Command):
description = 'compile message catalogs to MO files via django compilemessages'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
orig_dir = os.getcwd()
try:
from django.core.management import call_command
for path, dirs, files in os.walk('combo'):
if 'locale' not in dirs:
continue
curdir = os.getcwd()
os.chdir(os.path.realpath(path))
call_command('compilemessages')
os.chdir(curdir)
except ImportError:
sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
os.chdir(orig_dir)
class eo_sdist(sdist):
sub_commands = [('compile_translations', None)] + sdist.sub_commands
def run(self):
if os.path.exists('VERSION'):
os.remove('VERSION')
version = get_version()
version_file = open('VERSION', 'w')
version_file.write(version)
version_file.close()
sdist.run(self)
if os.path.exists('VERSION'):
os.remove('VERSION')
class build(_build):
sub_commands = [('compile_translations', None)] + _build.sub_commands
class install_lib(_install_lib):
def run(self):
self.run_command('compile_translations')
_install_lib.run(self)
CLASSIFIERS = [
'Framework :: Django',
@ -35,8 +119,8 @@ install_requires = [
setup(
name="django-import-export",
description="Django application and library for importing and exporting"
"data with included admin integration.",
version=VERSION,
"data with included admin integration.",
version=get_version(),
author="Informatika Mihelac",
author_email="bmihelac@mihelac.org",
license='BSD License',
@ -48,4 +132,10 @@ setup(
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*",
classifiers=CLASSIFIERS,
zip_safe=False,
cmdclass={
'build': build,
'install_lib': install_lib,
'compile_translations': compile_translations,
'sdist': eo_sdist
},
)