-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract setup.py tasks in methods, generify Makefile, use package for…
… version number
- Loading branch information
Showing
2 changed files
with
44 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,40 @@ | ||
from distutils.core import setup | ||
from setuptools import find_packages | ||
|
||
def get_version(): | ||
import universal | ||
return universal.__version__ | ||
|
||
def get_requirements(): | ||
with open('requirements.txt', 'rU') as fhan: | ||
requires = [line.strip() for line in fhan.readlines()] | ||
return requires | ||
|
||
def get_long_description(): | ||
try: | ||
import pypandoc | ||
long_description = pypandoc.convert('README.md', 'rst') | ||
except (IOError, ImportError): | ||
with open('README.txt') as fhan: | ||
long_description = fhan.read() | ||
|
||
|
||
add_keywords = dict( | ||
entry_points={ | ||
'console_scripts': ['universal = universal.main:main'], | ||
}, ) | ||
|
||
fhan = open('requirements.txt', 'rU') | ||
requires = [line.strip() for line in fhan.readlines()] | ||
fhan.close() | ||
try: | ||
import pypandoc | ||
long_description = pypandoc.convert('README.md', 'rst') | ||
except (IOError, ImportError): | ||
fhan = open('README.txt') | ||
long_description = fhan.read() | ||
fhan.close() | ||
|
||
setup( | ||
name='Universal', | ||
description='Universal Competitive Programming Suite helps you work' | ||
' faster in programming competitions', | ||
version='2.0.1', | ||
version=get_version(), | ||
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", | ||
"tests"]), | ||
license='GPLv3+', | ||
author='Shubham Chaudhary', | ||
author_email='me@shubhamchaudhary.in', | ||
url='https://github.com/shubhamchaudhary/universal', | ||
long_description=long_description, | ||
install_requires=requires, **add_keywords) | ||
long_description=get_long_description(), | ||
install_requires=get_requirements(), | ||
**add_keywords) |