Split up extra requirements away from the rest of the project.

Add setup.py for PyPI distribution.
Enhance Invoke tasks.
This commit is contained in:
Dorian 2014-07-22 20:19:52 -04:00
parent a4e22c1f9b
commit 6b9ecb5785
4 changed files with 43 additions and 1 deletions

View File

@ -1,4 +1,3 @@
# Requirements for developing the justCheckers app # Requirements for developing the justCheckers app
Sphinx>=1.2.2 Sphinx>=1.2.2
nose>=1.3.0 nose>=1.3.0

2
requirements/web.txt Normal file
View File

@ -0,0 +1,2 @@
# Requirements for the web front for justCheckers
Flask>=0.10

37
setup.py Normal file
View File

@ -0,0 +1,37 @@
# coding=utf-8
import re
from setuptools import setup, find_packages
def gather_requirements(filename='requirements.txt'):
"""
Gather the requirements from a requirements file.
:param filename: The name of the file.
"""
with open(filename) as req_file:
raw_requirements = req_file.readlines()
return [requirement.strip()
for requirement in raw_requirements
if requirement.strip() and not re.match('#|-(?!e)', requirement)]
setup(
name='justcheckers',
version='0.5.0',
packages=['justcheckers'],
url='http://justcheckers.org/',
license='Affero GPL v3',
author='Dorian Pula',
author_email='dorian.pula@gmail.com',
description='An advanced cross-platform checkers game.',
install_requires=gather_requirements(),
extras_requires={
'web': gather_requirements('requirements/web.txt'),
},
packages=find_packages('justcheckers'),
include_package_data=True,
)

View File

@ -3,15 +3,19 @@ from os import path
from invoke import task, run from invoke import task, run
@task @task
def docs(): def docs():
"""Build Sphinx documentation."""
build_dir = '_build' build_dir = '_build'
if not path.exists(build_dir): if not path.exists(build_dir):
os.mkdir(build_dir) os.mkdir(build_dir)
run('sphinx-build -b slides . _build') run('sphinx-build -b slides . _build')
@task @task
def clean(): def clean():
"""Clean generated files."""
run('rm *.pyc') run('rm *.pyc')
run('rm _build -rv') run('rm _build -rv')