Skip to content

Commit

Permalink
protcur setup.py first pass at unit data files
Browse files Browse the repository at this point in the history
  • Loading branch information
tgbugs committed Oct 30, 2019
1 parent 8323a3d commit c146257
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 36 deletions.
3 changes: 3 additions & 0 deletions protcur/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
recursive-include test *
recursive-include units *.rkt
include README.org
exclude MANIFEST.in
exclude units/parsing.rkt
recursive-exclude *.egg-info *
recursive-exclude * *.pyc
recursive-exclude * *.swp
Expand Down
5 changes: 2 additions & 3 deletions protcur/protcur/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@
#from pysercomb import parsing_parsec
from hyputils.hypothesis import HypothesisAnnotation, HypothesisHelper, idFromShareLink
from protcur.core import linewrap, color_pda, log, logd
from protcur.config import __script_folder__
from protcur.config import __units_folder__ as units_folder
from IPython import embed

sgv = Vocabulary(cache=True)
RFU = 'protc:references-for-use'
parameter_expression, *_ = units.make_unit_parser(Path(__script_folder__,
'../../protc-lib/protc/units'))
parameter_expression, *_ = units.make_unit_parser(units_folder)
error_output = []

# utility
Expand Down
8 changes: 6 additions & 2 deletions protcur/protcur/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from pathlib import Path
__script_folder__ = Path(__file__).resolve().parent
__units_folder__ = Path(__script_folder__, '../../protc-lib/protc/units')
__units_test_folder__ = Path(__script_folder__, '../../protc-lib/protc/units/test')
__units_test_params__ = Path(__script_folder__, '../../protc-lib/protc/units/test/params.rkt')

if not __units_folder__.exists():
__units_folder__ = Path('/usr/share')

__units_test_folder__ = __units_folder__ / 'test'
__units_test_params__ = __units_test_folder__ / 'params.rkt'
87 changes: 56 additions & 31 deletions protcur/setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import re
import sys
import shutil
from pathlib import Path
from setuptools import setup


Expand All @@ -16,36 +19,58 @@ def find_version(filename):
# TODO pandoc conversion
long_description = f.read()


RELEASE = '--release' in sys.argv
if RELEASE:
sys.argv.remove('--release')
from protcur.config import __units_folder__, __units_test_folder__
units = [p.name for p in __units_folder__.iterdir()
if p.is_file() and p.name != 'parsing.rkt' and p.suffix == '.rkt']
units_test = [p.parent.name + '/' + p.name
for p in __units_test_folder__.iterdir()
if p.is_file() and p.suffix == '.rkt']
shutil.copytree(__units_folder__, 'units')
data_files=[('protcur/units', units),
('protcur/units/test', units_test)]
else:
data_files = []

tests_require = ['pytest', 'pytest-runner']
setup(name='protcur',
version=__version__,
description='A dashboard for web annotation workflows for protocol curation.',
long_description=long_description,
long_description_content_type='text/plain',
url='https://github.com/tgbugs/protc/tree/master/protcur',
author='Tom Gillespie',
author_email='[email protected]',
license='MIT',
classifiers=[],
keywords=('protc protocols dashboard curation '
'hypothesis hypothes.is web annotation'),
packages=['protcur'],
python_requires='>=3.6',
install_requires=[
'flask',
'htmlfn',
'hyputils>=0.0.4',
'Markdown',
'pyontutils>=0.1.3',
'pysercomb',
],
extras_require={'dev':[],
'test': tests_require,
},
entry_points={
'console_scripts': [
'protcur-server=protcur.server:main',
'protcur-analysis=protcur.analysis:main',

try:
setup(name='protcur',
version=__version__,
description='A dashboard for web annotation workflows for protocol curation.',
long_description=long_description,
long_description_content_type='text/plain',
url='https://github.com/tgbugs/protc/tree/master/protcur',
author='Tom Gillespie',
author_email='[email protected]',
license='MIT',
classifiers=[],
keywords=('protc protocols dashboard curation '
'hypothesis hypothes.is web annotation'),
packages=['protcur'],
python_requires='>=3.6',
install_requires=[
'flask',
'htmlfn',
'hyputils>=0.0.4',
'Markdown',
'pyontutils>=0.1.3',
'pysercomb',
],
},
)
extras_require={'dev':[],
'test': tests_require,
},
entry_points={
'console_scripts': [
'protcur-server=protcur.server:main',
'protcur-analysis=protcur.analysis:main',
],
},
data_files=data_files,
)
finally:
if RELEASE:
shutil.rmtree('units')

0 comments on commit c146257

Please sign in to comment.