python-ox/setup.py

67 lines
2.1 KiB
Python
Raw Normal View History

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