python-ox/setup.py

68 lines
2 KiB
Python
Raw Normal View History

2008-04-27 18:54:37 +02:00
#!/usr/bin/env python
2008-06-19 11:21:21 +02:00
# vi:si:et:sw=4:sts=4:ts=4
2008-04-27 18:54:37 +02:00
# encoding: utf-8
2015-11-15 14:52:59 +01:00
try:
from setuptools import setup
except:
from distutils.core import setup
2015-11-15 14:52:59 +01:00
def get_revision():
import subprocess
2016-08-27 20:20:51 +02:00
return subprocess.check_output(['git', 'rev-list', 'HEAD', '--count']).decode().strip()
2015-11-15 14:52:59 +01:00
2014-10-01 11:03:39 +02:00
def get_version():
import os
2013-04-24 15:52:49 +02:00
import re
2015-11-15 14:52:59 +01:00
_git = os.path.join(os.path.dirname(__file__), '.git')
2014-10-01 11:03:39 +02:00
__version = os.path.join(os.path.dirname(__file__), 'ox/__version.py')
2014-10-02 08:34:42 +02:00
changelog = os.path.join(os.path.dirname(__file__), 'debian/changelog')
2015-11-15 14:52:59 +01:00
if os.path.exists(_git):
rev = get_revision()
2011-10-08 10:29:20 +02:00
if rev:
2015-11-15 15:11:20 +01:00
version = "2.3.%s" % rev
2014-10-01 11:03:39 +02:00
with open(__version, 'w') as fd:
2016-06-08 15:50:57 +02:00
fd.write('VERSION="%s"' % version)
2014-10-01 11:03:39 +02:00
return version
elif os.path.exists(__version):
with open(__version) as fd:
data = fd.read().strip().split('\n')[0]
2014-10-02 08:34:42 +02:00
version = re.compile('VERSION="(.*)"').findall(data)
2014-10-01 11:03:39 +02:00
if version:
version = version[0]
return version
2014-10-02 08:34:42 +02:00
elif os.path.exists(changelog):
f = open(changelog)
head = f.read().strip().split('\n')[0]
f.close()
rev = re.compile('\d+\.\d+\.(\d+)').findall(head)
if rev:
2014-10-05 20:40:04 +02:00
return '2.3.%s' % rev[0]
return '2.3.x'
2008-04-27 18:54:37 +02:00
2008-04-27 18:54:37 +02:00
setup(
2010-07-08 00:34:04 +02:00
name="ox",
2016-06-08 15:50:57 +02:00
version=get_version(),
2010-09-03 23:19:19 +02:00
description="python-ox - the web in a dict",
2010-09-04 13:05:33 +02:00
author="0x2620",
author_email="0x2620@0x2620.org",
url="https://code.0x2620.org/0x2620/python-ox",
2008-06-19 11:21:21 +02:00
license="GPLv3",
2016-02-20 14:50:28 +05:30
packages=['ox', 'ox.torrent', 'ox.web'],
2018-01-14 16:47:15 +01:00
install_requires=['six>=1.5.2', 'chardet'],
2016-06-08 15:50:57 +02:00
keywords=[
2008-06-19 11:21:21 +02:00
],
2016-06-08 15:50:57 +02:00
classifiers=[
2008-06-19 11:21:21 +02:00
'Operating System :: OS Independent',
'Programming Language :: Python',
2014-09-28 21:57:02 +02:00
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
2014-09-30 21:04:46 +02:00
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
2016-06-08 15:50:57 +02:00
'Programming Language :: Python :: 3.5',
2008-06-19 11:21:21 +02:00
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
2008-04-27 18:54:37 +02:00