debian-django-tenant-schemas/setup.py

69 lines
2.2 KiB
Python
Executable File

#!/usr/bin/env python
import os
import subprocess
from os.path import exists
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def get_version():
'''Use the VERSION, if absent generates a version with git describe, if not
tag exists, take 0.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', '--match=v*'], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
result = p.communicate()[0]
if p.returncode == 0:
result = result.split()[0][1:]
else:
result = '0.0.0-%s' % len(subprocess.check_output(
['git', 'rev-list', 'HEAD']).splitlines())
return result.replace('-', '.').replace('.g', '+g')
return '0.0.0'
setup(
name='django-tenant-schemas',
version=get_version(),
author='Bernardo Pires Carneiro',
author_email='carneiro.be@gmail.com',
packages=[
'tenant_schemas',
'tenant_schemas.migration_executors',
'tenant_schemas.postgresql_backend',
'tenant_schemas.management',
'tenant_schemas.management.commands',
'tenant_schemas.templatetags',
'tenant_schemas.test',
'tenant_schemas.tests',
],
scripts=[],
url='https://github.com/bcarneiro/django-tenant-schemas',
license='MIT',
description='Tenant support for Django using PostgreSQL schemas.',
long_description=open('README.rst').read() if exists("README.rst") else "",
classifiers=[
'License :: OSI Approved :: MIT License',
'Framework :: Django',
'Framework :: Django :: 1.8',
'Framework :: Django :: 1.9',
'Framework :: Django :: 1.10',
'Programming Language :: Python',
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.5",
"Topic :: Database",
"Topic :: Software Development :: Libraries",
],
install_requires=[
'Django >= 1.8.0',
'psycopg2',
],
zip_safe=False,
)