-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #514 from wd15/pip
Make pymks pip installable
- Loading branch information
Showing
5 changed files
with
111 additions
and
36 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
#!/usr/bin/env python | ||
|
||
"""PyMKS - the materials knowledge system in Python | ||
See the documenation for details at https://pymks.org | ||
""" | ||
|
||
import warnings | ||
import os | ||
import subprocess | ||
from setuptools import setup, find_packages | ||
import os | ||
|
||
|
||
def make_version(package_name): | ||
|
@@ -11,6 +17,7 @@ def make_version(package_name): | |
Returns: | ||
version number of the form "3.1.1.dev127+g413ed61". | ||
""" | ||
|
||
def _minimal_ext_cmd(cmd): | ||
"""Run a command in a subprocess. | ||
|
@@ -22,28 +29,22 @@ def _minimal_ext_cmd(cmd): | |
""" | ||
# construct minimal environment | ||
env = {} | ||
for k in ['SYSTEMROOT', 'PATH']: | ||
for k in ["SYSTEMROOT", "PATH"]: | ||
value = os.environ.get(k) | ||
if value is not None: | ||
env[k] = value | ||
# LANGUAGE is used on win32 | ||
env['LANGUAGE'] = 'C' | ||
env['LANG'] = 'C' | ||
env['LC_ALL'] = 'C' | ||
out = subprocess.Popen(cmd, | ||
stdout=subprocess.PIPE, | ||
env=env).communicate()[0] | ||
env["LANGUAGE"] = "C" | ||
env["LANG"] = "C" | ||
env["LC_ALL"] = "C" | ||
out = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=env).communicate()[0] | ||
return out | ||
|
||
version = 'unknown' | ||
version = "unknown" | ||
|
||
if os.path.exists('.git'): | ||
if os.path.exists(".git"): | ||
try: | ||
out = _minimal_ext_cmd(['git', | ||
'describe', | ||
'--tags', | ||
'--match', | ||
'v*']) | ||
out = _minimal_ext_cmd(["git", "describe", "--tags", "--match", "v*"]) | ||
# ticket:475 - fix for bytecode received in Py3k | ||
# http://jeetworks.org/node/67 | ||
outdecode = out.decode("utf-8") | ||
|
@@ -57,13 +58,16 @@ def _minimal_ext_cmd(cmd): | |
else: | ||
version = version[0][1:] | ||
except OSError: | ||
import warnings | ||
warnings.warn("Could not run ``git describe``") | ||
elif os.path.exists('pymks.egg-info'): | ||
elif os.path.exists("pymks.egg-info"): | ||
# pylint: disable=import-outside-toplevel | ||
from pkg_resources import get_distribution, DistributionNotFound | ||
|
||
try: | ||
version = get_distribution(package_name).version # pylint: disable=no-member | ||
except DistributionNotFound: # pragma: no cover | ||
version = get_distribution( | ||
package_name | ||
).version # pylint: disable=no-member | ||
except DistributionNotFound: # pragma: no cover | ||
version = "unknown, try running `python setup.py egg_info`" | ||
|
||
return version | ||
|
@@ -72,13 +76,25 @@ def _minimal_ext_cmd(cmd): | |
PACKAGE_NAME = "pymks" | ||
|
||
|
||
setup(name=PACKAGE_NAME, | ||
version=make_version(PACKAGE_NAME), | ||
description='Materials Knowledge Systems in Python (PyMKS)', | ||
author='Daniel Wheeler', | ||
author_email='[email protected]', | ||
url='http://pymks.org', | ||
packages=find_packages(), | ||
package_data={'': ['tests/*.py']}, | ||
install_requires=[], | ||
data_files=['setup.cfg']) | ||
setup( | ||
name=PACKAGE_NAME, | ||
version=make_version(PACKAGE_NAME), | ||
description="Materials Knowledge Systems in Python (PyMKS)", | ||
author="Daniel Wheeler", | ||
author_email="[email protected]", | ||
url="http://pymks.org", | ||
packages=find_packages(), | ||
package_data={"": ["tests/*.py"]}, | ||
install_requires=[ | ||
"pytest", | ||
"numpy", | ||
"dask", | ||
"Deprecated", | ||
"matplotlib", | ||
"scikit-learn", | ||
"pytest-cov", | ||
"nbval", | ||
"toolz", | ||
], | ||
data_files=["setup.cfg"], | ||
) |