Skip to content

Commit

Permalink
protcur use orthauth, ver bump, update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
tgbugs committed Nov 25, 2019
1 parent 9a2feff commit 40420f5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 39 deletions.
2 changes: 1 addition & 1 deletion protcur/protcur/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.2.dev0'
__version__ = '0.0.2'
22 changes: 22 additions & 0 deletions protcur/protcur/auth-config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{'config-search-paths': ['{:user-config-path}/protcur/config.yaml',],
'auth-variables':
{'units-folder': {'environment-variables': 'PROTCUR_UNITS_FOLDER',
'default': ['../../protc-lib/units', # git
'../resources/units', # test sdist
'{:user-data-path}/protcur/units', # pip install --user
'{:prefix}/share/protcur/units', # system
'/usr/share/protcur/units', # pypy3
'{:cwd}/share/protcur/units', # ebuild testing
],
},
'tags-folder-file': {'environment-variables': 'PROTCUR_TAGS_FOLDER_FILE', # NOTE you must provide path to the test file
'default': ['../../protc-tags.rkt', # git
'../resources/protc-tags.rkt', # test sdist
'{:user-data-path}/protcur/protc-tags.rkt', # pip install --user
'{:prefix}/share/protcur/protc-tags.rkt', # system
'/usr/share/protcur/protc-tags.rkt', # pypy3
'{:cwd}/share/protcur/protc-tags.rkt', # ebuild testing
],
},
},
}
41 changes: 4 additions & 37 deletions protcur/protcur/config.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,15 @@
import sys
from pathlib import Path
import appdirs
import orthauth as oa

__script_folder__ = Path(__file__).resolve().parent
auth = oa.configure_relative('auth-config.py')

# units
__units_folder__ = Path(__script_folder__, '../../protc-lib/protc/units')

if not __units_folder__.exists():
_attempts = [
Path(__script_folder__, '../resources/units'),
Path(appdirs.user_data_dir(), 'protcur', 'units'), # pip install --user
Path(sys.prefix, 'share', 'protcur', 'units'),
Path('/usr', 'share', 'protcur', 'units'), # pypy3
Path('share', 'protcur', 'units'), # ebuild testing
]
for attempt in _attempts:
if attempt.exists():
__units_folder__ = attempt
break
else:
raise FileNotFoundError('no units folder was found at any of\n'
f'{[__units_folder__] + _attempts}')

__units_folder__ = auth.get_path('units-folder')
__units_test_folder__ = __units_folder__ / 'test'
__units_test_params__ = __units_test_folder__ / 'params.rkt'

# tags
__tags_folder__ = Path(__script_folder__, '../../.')
if not (__tags_folder__ / 'protc-tags.rkt').exists():
_attempts = [
Path(__script_folder__, '../resources'),
Path(appdirs.user_data_dir(), 'protcur'), # pip install --user
Path(sys.prefix, 'share', 'protcur'),
Path('/usr', 'share', 'protcur'), # pypy3
Path('share', 'protcur'), # ebuild testing
]
for attempt in _attempts:
if (attempt / 'protc-tags.rkt').exists():
__tags_folder__ = attempt
break
else:
raise FileNotFoundError('no tags folder was found at any of\n'
f'{[__tags_folder__] + _attempts}')

__tags_folder__ = auth.get_path('tags-folder-file').parent
__anno_tags__ = __tags_folder__ / 'anno-tags.rkt'
__protc_tags__ = __tags_folder__ / 'protc-tags.rkt'
2 changes: 1 addition & 1 deletion protcur/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def find_version(filename):
'htmlfn',
'hyputils>=0.0.4',
'Markdown',
'pyontutils>=0.1.4',
'pyontutils>=0.1.8',
'pysercomb>=0.0.2',
],
extras_require={'dev':['pytest-cov', 'wheel'],
Expand Down

0 comments on commit 40420f5

Please sign in to comment.