Skip to content

Commit

Permalink
Merge pull request areski#81 from marcogiusti/setup_imp
Browse files Browse the repository at this point in the history
Simplify setup.py script.
  • Loading branch information
areski authored Jun 30, 2016
2 parents 226572a + b8ce0f6 commit 97f5ae4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 42 deletions.
12 changes: 5 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ python:
- 3.3
- 3.4
- 3.5
env:
- DJANGO_VERSION=1.9.*
- DJANGO_VERSION=1.8.*
install:
- if [[ $TRAVIS_PYTHON_VERSION == 3.3 ]]; then pip install 'Django<1.9'; fi
- pip install Django=="$DJANGO_VERSION"
- python setup.py install
script:
- python setup.py test
notifications:
email: true
branches:
only:
- develop
- if [[ $DJANGO_VERSION != 1.9.* || $TRAVIS_PYTHON_VERSION != 3.3 ]]; then python setup.py test; fi
58 changes: 23 additions & 35 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,57 +1,40 @@
from setuptools import setup, find_packages
import django_nvd3
import re


with open('README.rst') as readme_file:
readme = readme_file.read()
def get_version(filename="django_nvd3/__init__.py", varname="__version__"):
glb = {}
with open(filename) as fp:
for line in fp:
if varname in line:
exec(line, glb)
break
return glb[varname]


with open('CHANGELOG.rst') as history_file:
history = history_file.read().replace('.. :changelog:', '')
def readfile(filename):
with open(filename) as fp:
return fp.read()


def parse_requirements(file_name):
requirements = []
for line in open(file_name, 'r').read().split('\n'):
if re.match(r'(\s*#)|(\s*$)', line):
continue
if re.match(r'\s*-e\s+', line):
requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', line))
elif re.match(r'(\s*git)|(\s*hg)', line):
pass
else:
requirements.append(line)
return requirements


def parse_dependency_links(file_name):
dependency_links = []
for line in open(file_name, 'r').read().split('\n'):
if re.match(r'\s*-[ef]\s+', line):
dependency_links.append(re.sub(r'\s*-[ef]\s+', '', line))

return dependency_links
readme = readfile('README.rst')
history = readfile('CHANGELOG.rst').replace('.. :changelog:', '')


setup(
name='django-nvd3',
version=django_nvd3.__version__,
version=get_version(),
description="Django NVD3 - Chart Library for d3.js",
long_description=readme + '\n\n' + history,
keywords='django, nvd3, chart, graph, d3',
url='https://github.com/areski/django-nvd3',
author='Belaid Arezqui',
author_email='[email protected]',
license='MIT License',
license='MIT',
zip_safe=False,
packages=find_packages(exclude=["tests", "demoproject", "docs"]),
include_package_data=True,
package_data={},
install_requires=parse_requirements('requirements.txt'),
tests_require=parse_requirements('test_requirements.txt'),
packages=["django_nvd3"],
install_requires=["Django", "python-nvd3"],
test_suite='tests',
dependency_links=parse_dependency_links('requirements.txt'),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
Expand All @@ -60,6 +43,11 @@ def parse_dependency_links(file_name):
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules'
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],
)

0 comments on commit 97f5ae4

Please sign in to comment.