Skip to content

Commit

Permalink
moved version number inside python package and fixed problem with lin…
Browse files Browse the repository at this point in the history
…king catalog dir inside python path by doing a recursive copy/delete of catalog dir. python setup.py egg_info now works. Alsoupgraded version number to 0.1.1 to push new version to PyPI.
  • Loading branch information
tclose committed Nov 30, 2017
1 parent 1038918 commit 62640d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions ninemlcatalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import os.path
import nineml

__version__ = '0.1.1'

root = os.path.abspath(os.path.join(os.path.dirname(__file__), 'catalog'))
# Check to see if package has been installed via pip (not actually recommended)
# and catalog has been linked inside the package directory, else use the one
Expand Down
16 changes: 11 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
#!/usr/bin/env python

import sys
import os.path
import shutil
from setuptools import setup, find_packages

SUB_CATALOG_NAME = 'catalog'
XML_NAME = 'xml'
PACKAGE_NAME = 'ninemlcatalog'
VERSION = '0.1'

src_dir = os.path.abspath(os.path.dirname(__file__))
xml_dir = os.path.join(src_dir, XML_NAME)
catalog_dir = os.path.join(src_dir, PACKAGE_NAME, SUB_CATALOG_NAME)

# Get version number
sys.path.insert(0, src_dir)
from ninemlcatalog import __version__
sys.path.pop(0)

# Build package data paths to model description files
package_data = []
prefix_len = len(xml_dir) + 1
Expand All @@ -23,10 +29,10 @@
try:
# Create a symlink to the catalog path inside the package directory so it
# gets installed within the python package
os.symlink(xml_dir, catalog_dir)
shutil.copytree(xml_dir, catalog_dir)
setup(
name=PACKAGE_NAME,
version=VERSION,
version=__version__,
packages=find_packages(),
package_data={PACKAGE_NAME: package_data},
author=("The NineML Committee"),
Expand All @@ -42,7 +48,7 @@
classifiers=['Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT Licence',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
Expand All @@ -58,4 +64,4 @@
tests_require=['nose']
)
finally:
os.unlink(catalog_dir)
shutil.rmtree(catalog_dir, ignore_errors=True)

0 comments on commit 62640d2

Please sign in to comment.