-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build setup.py and requirements files using moban
coala-mobans provides a set of metadata common to all repositories, with local overrides. Related to coala/meta#117
- Loading branch information
Showing
6 changed files
with
164 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,30 @@ | ||
overrides: coala.yaml | ||
|
||
name: coala-quickstart | ||
contact: [email protected] | ||
description: A quickstart tool for coala | ||
current_version: 0.4.0 | ||
version: 0.4.0 | ||
build_version: 0.4.0 | ||
package_module: coala_quickstart | ||
url: https://github.com/coala/coala-quickstart | ||
docs_output_dir: false | ||
|
||
maintainers: false | ||
maintainer_list: | ||
- Satwik Kansal | ||
- Adrian Zatreanu | ||
- Alexandros Dimos | ||
- Adhityaa Chandrasekar | ||
maintainer_emails: | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
- [email protected] | ||
|
||
entry_points: | ||
console_scripts: | ||
- coala-quickstart = coala_quickstart.coala_quickstart:main | ||
|
||
dependencies: | ||
# TODO: Remove lxml once the upstream issue https://github.com/vfaronov/httpolice/issues/5 with HTTpolice is fixed. | ||
|
@@ -17,5 +41,8 @@ configuration: | |
configuration: .moban.yaml | ||
configuration_dir: ../coala-mobans/ | ||
targets: | ||
- setup.py: coala-setup.py.jj2 | ||
- requirements.txt: requirements.txt.jj2 | ||
- test-requirements.txt: test-requirements.txt.jj2 | ||
- coala_quickstart/VERSION: VERSION.jj2 | ||
- coala_quickstart/__init__.py: __init__.py.jj2 |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
0.4.0 |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from os.path import join, dirname | ||
|
||
|
||
VERSION_FILE = join(dirname(__file__), 'VERSION') | ||
|
||
|
||
def get_version(): | ||
with open(VERSION_FILE, 'r') as ver: | ||
return ver.readline().strip() | ||
|
||
|
||
VERSION = get_version() | ||
__version__ = VERSION |
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,43 +1,144 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import locale | ||
import os | ||
import platform | ||
import sys | ||
|
||
import setuptools.command.build_py | ||
from setuptools import find_packages, setup | ||
from setuptools.command.test import test as TestCommand | ||
|
||
try: | ||
locale.getlocale() | ||
except (ValueError, UnicodeError): | ||
lc = locale.getlocale() | ||
pf = platform.system() | ||
if pf != 'Windows' and lc == (None, None): | ||
locale.setlocale(locale.LC_ALL, 'C.UTF-8') | ||
except (ValueError, UnicodeError, locale.Error): | ||
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') | ||
|
||
with open('requirements.txt') as requirements: | ||
required = requirements.read().splitlines() | ||
VERSION = '0.4.0' | ||
DEPENDENCY_LINKS = [] | ||
|
||
SETUP_COMMANDS = {} | ||
|
||
|
||
def set_python_path(path): | ||
if 'PYTHONPATH' in os.environ: | ||
user_paths = os.environ['PYTHONPATH'].split(os.pathsep) | ||
user_paths.insert(0, path) | ||
os.environ['PYTHONPATH'] = os.pathsep.join(user_paths) | ||
else: | ||
os.environ['PYTHONPATH'] = path | ||
|
||
|
||
class PyTestCommand(TestCommand): | ||
""" | ||
From https://pytest.org/latest/goodpractices.html | ||
""" | ||
user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')] | ||
|
||
def initialize_options(self): | ||
TestCommand.initialize_options(self) | ||
self.pytest_args = [] | ||
|
||
def finalize_options(self): | ||
TestCommand.finalize_options(self) | ||
self.test_args = [] | ||
self.test_suite = True | ||
|
||
def run_tests(self): | ||
# import here, cause outside the eggs aren't loaded | ||
import pytest | ||
errno = pytest.main(self.pytest_args) | ||
sys.exit(errno) | ||
|
||
|
||
SETUP_COMMANDS['test'] = PyTestCommand | ||
|
||
|
||
__dir__ = os.path.dirname(__file__) | ||
|
||
|
||
def read_requirements(filename): | ||
""" | ||
Parse a requirements file. | ||
Accepts vcs+ links, and places the URL into | ||
`DEPENDENCY_LINKS`. | ||
:return: list of str for each package | ||
""" | ||
data = [] | ||
filename = os.path.join(__dir__, filename) | ||
with open(filename) as requirements: | ||
required = requirements.read().splitlines() | ||
for line in required: | ||
if not line or line.startswith('#'): | ||
continue | ||
|
||
if '+' in line[:4]: | ||
repo_link, egg_name = line.split('#egg=') | ||
if not egg_name: | ||
raise ValueError('Unknown requirement: {0}' | ||
.format(line)) | ||
|
||
DEPENDENCY_LINKS.append(repo_link) | ||
|
||
line = egg_name.replace('-', '==') | ||
|
||
data.append(line) | ||
|
||
return data | ||
|
||
|
||
required = read_requirements('requirements.txt') | ||
|
||
test_required = read_requirements('test-requirements.txt') | ||
|
||
filename = os.path.join(__dir__, 'README.rst') | ||
with open(filename) as readme: | ||
long_description = readme.read() | ||
|
||
extras_require = None | ||
EXTRAS_REQUIRE = {} | ||
data_files = None | ||
|
||
with open('test-requirements.txt') as requirements: | ||
test_required = requirements.read().splitlines() | ||
if extras_require: | ||
EXTRAS_REQUIRE = extras_require | ||
SETUP_COMMANDS.update({ | ||
}) | ||
|
||
if __name__ == '__main__': | ||
setup(name='coala-quickstart', | ||
version='0.4.0', | ||
version=VERSION, | ||
description='A quickstart tool for coala', | ||
author='The coala developers', | ||
maintainer='Satwik Kansal, Adrian Zatreanu, Alexandros Dimos, ' | ||
author_email='[email protected]', | ||
maintainer='Satwik Kansal, ' | ||
'Adrian Zatreanu, ' | ||
'Alexandros Dimos, ' | ||
'Adhityaa Chandrasekar', | ||
maintainer_email=('[email protected], ' | ||
'[email protected], ' | ||
'[email protected], ' | ||
'[email protected]'), | ||
url='https://github.com/coala/coala-quickstart', | ||
platforms='any', | ||
packages=find_packages(exclude=['build.*', '*.tests.*', '*.tests']), | ||
packages=find_packages(exclude=('build.*', 'tests', 'tests.*')), | ||
install_requires=required, | ||
extras_require=EXTRAS_REQUIRE, | ||
tests_require=test_required, | ||
dependency_links=DEPENDENCY_LINKS, | ||
package_data={'coala_quickstart': ['VERSION']}, | ||
license='AGPL-3.0', | ||
long_description='coala-quickstart is a tool to help you ' | ||
'quickly and easily get started with ' | ||
'coala.', | ||
data_files=data_files, | ||
long_description=long_description, | ||
entry_points={ | ||
'console_scripts': [ | ||
'coala-quickstart = coala_quickstart.coala_quickstart:main', | ||
]}, | ||
], | ||
}, | ||
# from http://pypi.python.org/pypi?%3Aaction=list_classifiers | ||
classifiers=[ | ||
'Development Status :: 4 - Beta', | ||
|
@@ -57,8 +158,11 @@ | |
'Programming Language :: Python :: Implementation :: CPython', | ||
'Programming Language :: Python :: 3.4', | ||
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3 :: Only', | ||
|
||
'Topic :: Scientific/Engineering :: Information Analysis', | ||
'Topic :: Software Development :: Quality Assurance', | ||
'Topic :: Text Processing :: Linguistic']) | ||
'Topic :: Text Processing :: Linguistic'], | ||
cmdclass=SETUP_COMMANDS, | ||
) |