Skip to content

Commit

Permalink
setup.py release compatible with building bdist from sdist and use __…
Browse files Browse the repository at this point in the history
…version__
  • Loading branch information
tgbugs committed Apr 2, 2019
1 parent c2c7a33 commit 4a3c7ca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
2 changes: 2 additions & 0 deletions ontquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
from ontquery import plugin

__all__ = ['OntCuries', 'OntId', 'OntTerm', 'OntQuery', 'OntQueryCli']

__version__ = '0.0.8'
33 changes: 18 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import sys
import shutil
from setuptools import setup
from ontquery import __version__

with open('README.md', 'rt') as f:
long_description = f.read()
Expand All @@ -28,24 +29,26 @@
]

if RELEASE:
# append to files
files.append(namespaces)
files.append(scigraph_client)

# namespaces
from pyontutils.namespaces import PREFIXES
if not Path(namespaces).exists():
from pyontutils.namespaces import PREFIXES

lines = ['CURIE_MAP = {\n'] + [f' {k!r}: {v!r},\n'
for k, v in sorted(PREFIXES.items())] + ['}']
with open(namespaces, 'wt') as f:
f.writelines(lines)
lines = ['CURIE_MAP = {\n'] + [f' {k!r}: {v!r},\n'
for k, v in sorted(PREFIXES.items())] + ['}']
with open(namespaces, 'wt') as f:
f.writelines(lines)

# scigraph_client
status_code = os.system(('scigraph-codegen '
'-a https://scicrunch.org/api/1/scigraph -o ')
+ scigraph_client)
if status_code:
raise OSError(f'scigraph-codegen failed with status {status_code}')

# append to files
files.append(namespaces)
files.append(scigraph_client)
if not Path(scigraph_client).exists():
status_code = os.system(('scigraph-codegen '
'-a https://scicrunch.org/api/1/scigraph -o ')
+ scigraph_client)
if status_code:
raise OSError(f'scigraph-codegen failed with status {status_code}')

try:
os.mkdir('export')
Expand All @@ -55,7 +58,7 @@
tests_require = ['pytest', 'pytest-runner', 'rdflib', 'requests']
setup(
name='ontquery',
version='0.0.8',
version=__version__,
description='a framework querying ontology terms',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit 4a3c7ca

Please sign in to comment.