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-allauth-authentic2/setup.py

82 lines
2.3 KiB
Python
Executable File

#! /usr/bin/env python
''' Setup script
'''
import glob
import re
import sys
import os
from setuptools import setup, find_packages
from distutils.command.build import build as _build
from distutils.command.sdist import sdist
from distutils.cmd import Command
class eo_sdist(sdist):
def run(self):
print "creating VERSION file"
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"
if os.path.exists('VERSION'):
os.remove('VERSION')
def get_version():
version = None
for d in glob.glob('*'):
if not os.path.isdir(d):
continue
module_file = os.path.join(d, '__init__.py')
if not os.path.exists(module_file):
continue
for v in re.findall("""__version__ *= *['"](.*)['"]""",
open(module_file).read()):
assert version is None
version = v
if version:
break
assert version is not None
if os.path.exists('.git'):
import subprocess
p = subprocess.Popen(['git','describe','--dirty','--match=v*'],
stdout=subprocess.PIPE)
result = p.communicate()[0]
assert p.returncode == 0, 'git returned non-zero'
new_version = result.split()[0][1:]
assert new_version.split('-')[0] == version, '__version__ must match the last git annotated tag'
version = new_version.replace('-', '.')
return version
setup(name="allauth_a2",
version=get_version(),
license="AGPLv3 or later",
description="Authentic2 OAuth2 provider",
url="http://dev.entrouvert.org/",
author="Entr'ouvert",
author_email="info@entrouvert.org",
maintainer="Benjamin Dauvergne",
maintainer_email="info@entrouvert.com",
include_package_data=True,
packages=find_packages(),
scripts=(),
install_requires=[
'requests>=2.1',
'django-allauth',
],
dependency_links = [
'git+git://repos.entrouvert.org/django_allauth_a2_provider',
],
cmdclass={
'sdist': eo_sdist
},
)