-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
protcur setup.py more data file tweaks
add more possible locations for the units and tags folders
- Loading branch information
Showing
5 changed files
with
66 additions
and
12 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,9 +1,41 @@ | ||
import sys | ||
from pathlib import Path | ||
|
||
__script_folder__ = Path(__file__).resolve().parent | ||
|
||
# units | ||
__units_folder__ = Path(__script_folder__, '../../protc-lib/protc/units') | ||
|
||
if not __units_folder__.exists(): | ||
__units_folder__ = Path('/usr/share') | ||
_attempts = [ | ||
Path(__script_folder__, '../resources/units'), | ||
Path(sys.prefix, 'share', 'protcur', 'units'), | ||
] | ||
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_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(sys.prefix, 'share', 'protcur'), | ||
] | ||
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}') | ||
|
||
__anno_tags__ = __tags_folder__ / 'anno-tags.rkt' | ||
__protc_tags__ = __tags_folder__ / 'protc-tags.rkt' |
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
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