This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
django-kerberos/setup.py

78 lines
2.5 KiB
Python
Raw Normal View History

2014-08-09 01:19:09 +02:00
#! /usr/bin/env python
2016-02-09 11:56:28 +01:00
import subprocess
2016-02-24 11:05:49 +01:00
import os
2016-02-09 11:56:28 +01:00
2014-08-09 01:19:09 +02:00
from setuptools import setup, find_packages
2016-02-24 11:05:49 +01:00
from setuptools.command.sdist import sdist
class eo_sdist(sdist):
def run(self):
print("creating VERSION file")
2016-02-24 11:05:49 +01:00
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)
print("removing VERSION file")
2016-02-24 11:05:49 +01:00
if os.path.exists('VERSION'):
os.remove('VERSION')
2014-08-09 01:19:09 +02:00
2016-02-09 11:56:28 +01:00
2014-08-09 01:19:09 +02:00
def get_version():
2016-02-09 11:55:02 +01:00
'''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.
2016-02-09 11:55:02 +01:00
'''
if os.path.exists('VERSION'):
with open('VERSION', 'r') as v:
return v.read()
2014-08-09 01:19:09 +02:00
if os.path.exists('.git'):
p = subprocess.Popen(['git', 'describe', '--dirty=.dirty','--match=v*'], stdout=subprocess.PIPE,
2016-02-09 11:56:28 +01:00
stderr=subprocess.PIPE)
2014-08-09 01:19:09 +02:00
result = p.communicate()[0]
2016-02-09 11:55:02 +01:00
if p.returncode == 0:
result = result.decode('ascii').strip()[1:] # 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
2016-02-09 11:55:02 +01:00
else:
return '0.0.post%s' % len(
subprocess.check_output(
['git', 'rev-list', 'HEAD']).splitlines())
return '0.0'
2014-08-09 01:19:09 +02:00
setup(name="django-kerberos",
version=get_version(),
license="AGPLv3 or later",
2014-08-09 03:52:05 +02:00
description="Kerberos authentication for Django",
long_description=open('README').read(),
2014-08-09 01:19:09 +02:00
url="http://dev.entrouvert.org/projects/authentic/",
author="Entr'ouvert",
author_email="info@entrouvert.org",
maintainer="Benjamin Dauvergne",
maintainer_email="bdauvergne@entrouvert.com",
packages=find_packages('src'),
zip_safe=False,
include_package_data=True,
2014-08-09 01:19:09 +02:00
install_requires=[
'six',
'django>1.8',
2016-02-09 11:53:22 +01:00
'pykerberos',
2014-08-09 01:19:09 +02:00
],
package_dir={
'': 'src',
},
package_data={
'django_kerberos': [
'templates/django_kerberos/*.html',
2014-09-07 01:27:05 +02:00
'static/js/*.js',
2014-08-09 01:19:09 +02:00
],
},
2016-02-24 11:05:49 +01:00
cmdclass={'sdist': eo_sdist})