-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed version system from versioneer to setup_scm
- Loading branch information
1 parent
382edc0
commit 99cbcf7
Showing
11 changed files
with
290 additions
and
2,414 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
# ============================================================================= | ||
# Inherit values from ENV _or_ command line or use defaults for: | ||
# $PYTHON_VERSION e.g. 2.7.13 (use current unless given) | ||
# $PYTHON_SHORT e.g. 2.7 (optional) | ||
# $PYTHON_VSHORT e.g. 2 (optional) | ||
# | ||
# e.g. | ||
# > make install PYTHON_SHORT=2.7 PYTHON_VERSIONS=2.7.13 | ||
# | ||
# or | ||
# > setenv PYTHON_SHORT 2.7; setenv PYTHON_SHORT 2.7; | ||
# > make install | ||
# | ||
# $TARGET may also be applied explicitly for e.g. install at /project/res | ||
# > setenv RESTARGET ${SDP_BINDIST_ROOT}/lib/python${PYTHON_SHORT}/site-packages | ||
# > make siteinstall TARGET=$RESTARGET | ||
# ============================================================================= | ||
|
||
xt.PHONY: clean clean-test clean-pyc clean-build docs help pyver | ||
.DEFAULT_GOAL := help | ||
|
||
define PRINT_HELP_PYSCRIPT | ||
import re, sys | ||
for line in sys.stdin: | ||
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) | ||
if match: | ||
target, help = match.groups() | ||
print("%-20s %s" % (target, help)) | ||
endef | ||
export PRINT_HELP_PYSCRIPT | ||
|
||
|
||
APPLICATION := xtgeoapp_grd3dmaps | ||
DOCSINSTALL := /project/sdpdocs/XTGeo/apps | ||
|
||
BROWSER := firefox | ||
|
||
PYTHON_VERSION ?= $(shell python -c "import sys; print('{0[0]}.{0[1]}.{0[2]}'.format(sys.version_info))") | ||
PYTHON_SHORT ?= `echo ${PYTHON_VERSION} | cut -d. -f1,2` | ||
PYTHON_VSHORT ?= `echo ${PYTHON_VERSION} | cut -d. -f1` | ||
|
||
# Active python my be e.g. 'python3.4' or 'python3' (depends...) | ||
ifeq (, python${PYTHON_SHORT}) | ||
PSHORT := ${PYTHON_SHORT} | ||
else | ||
PSHORT := ${PYTHON_VSHORT} | ||
endif | ||
PYTHON := python${PSHORT} | ||
PIP := pip${PSHORT} | ||
|
||
|
||
TARGET := ${SDP_BINDIST_ROOT} | ||
|
||
|
||
help: | ||
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) | ||
|
||
|
||
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage... | ||
|
||
|
||
clean-build: ## remove build artifacts | ||
rm -fr build/ | ||
rm -fr dist/ | ||
rm -fr .eggs/ | ||
find . -name '*.egg-info' -exec rm -fr {} + | ||
find . -name '*.egg' -exec rm -fr {} + | ||
|
||
|
||
clean-pyc: ## remove Python file artifacts | ||
find . -name '*.pyc' -exec rm -f {} + | ||
find . -name '*.pyo' -exec rm -f {} + | ||
find . -name '*~' -exec rm -f {} + | ||
find . -name '__pycache__' -exec rm -fr {} + | ||
|
||
|
||
clean-test: ## remove test and coverage artifacts | ||
rm -fr .tox/ | ||
rm -f .coverage | ||
rm -fr htmlcov/ | ||
rm -fr TMP/ | ||
|
||
develop: ## make develop mode (for pure python only) | ||
${PIP} install -e . | ||
|
||
lint: ## check style with flake8 | ||
flake8 ${APPLICATION} tests | ||
|
||
|
||
test: ## run tests quickly with the default Python | ||
@${PYTHON} setup.py test | ||
|
||
coverage: ## check code coverage quickly with the default Python | ||
coverage run --source ${APPLICATION} -m pytest | ||
coverage report -m | ||
coverage html | ||
$(BROWSER) htmlcov/index.html | ||
|
||
|
||
docsrun: clean ## generate Sphinx HTML documentation, including API docs | ||
rm -f docs/${APPLICATION}*.rst | ||
rm -f docs/modules.rst | ||
rm -fr docs/_build | ||
$(MAKE) -C docs clean | ||
$(MAKE) -C docs html | ||
|
||
|
||
docs: docsrun ## generate and display Sphinx HTML documentation... | ||
$(BROWSER) docs/_build/html/index.html | ||
|
||
|
||
dist: clean ## builds wheel package | ||
@echo "Running ${PYTHON} (${PYTHON_VERSION}) bdist_wheel..." | ||
@${PYTHON} setup.py bdist_wheel | ||
|
||
|
||
install: dist | ||
@echo "Running ${PIP} (${PYTHON_VERSION}) ..." | ||
${PIP} install . --upgrade | ||
#@${PIP} install --upgrade --global-option=build \ | ||
#--global-option='--executable=/usr/bin/env python' . | ||
|
||
|
||
siteinstall: dist ## Install in project/res (Trondheim) using $TARGET | ||
@echo $(HOST) | ||
PYTHONUSERBASE=${TARGET} ${PIP} install . --user --upgrade | ||
|
||
userinstall: dist | ||
@echo $(HOST) | ||
PYTHONUSERBASE=${HOME} ${PIP} install . --user --upgrade | ||
|
||
|
||
docsinstall: docsrun | ||
rsync -av --delete docs/_build/html ${DOCSINSTALL}/${APPLICATION} | ||
/project/res/bin/res_perm ${DOCSINSTALL}/${APPLICATION} |
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 |
---|---|---|
|
@@ -2,72 +2,96 @@ | |
# -*- coding: utf-8 -*- | ||
|
||
"""The setup script.""" | ||
import fileinput | ||
import os | ||
import sys | ||
import sysconfig | ||
from glob import glob | ||
from os.path import basename | ||
from os.path import splitext | ||
|
||
from setuptools import setup, find_packages | ||
import versioneer | ||
|
||
with open('README.rst') as readme_file: | ||
APPS = ("grid3d_hc_thickness", "grid3d_average_map") | ||
|
||
|
||
def parse_requirements(filename): | ||
"""Load requirements from a pip requirements file""" | ||
try: | ||
lineiter = (line.strip() for line in open(filename)) | ||
return [line for line in lineiter if line and not line.startswith("#")] | ||
except IOError: | ||
return [] | ||
|
||
|
||
def src(x): | ||
root = os.path.dirname(__file__) | ||
return os.path.abspath(os.path.join(root, x)) | ||
|
||
|
||
def _post_install(): | ||
"""Replace the shebang line of console script fra spesific to a general""" | ||
print("POST INSTALL") | ||
spath = sysconfig.get_paths()["scripts"] | ||
xapps = [] | ||
for app in APPS: | ||
xapps.append(os.path.join(spath, app)) | ||
print(xapps) | ||
for line in fileinput.input(xapps, inplace=1): | ||
line = line.replace(spath + "/python", "/usr/bin/env python") | ||
sys.stdout.write(line) | ||
|
||
|
||
with open("README.rst") as readme_file: | ||
readme = readme_file.read() | ||
|
||
with open('HISTORY.rst') as history_file: | ||
with open("HISTORY.rst") as history_file: | ||
history = history_file.read() | ||
|
||
requirements = [ | ||
# TODO: put package requirements here | ||
] | ||
|
||
setup_requirements = [ | ||
'pytest-runner', | ||
# TODO(jriv): put setup requirements (distutils extensions, etc.) here | ||
] | ||
requirements = parse_requirements("requirements.txt") | ||
|
||
test_requirements = [ | ||
'pytest', | ||
# TODO: put package test requirements here | ||
] | ||
setup_requirements = ["pytest-runner", "wheel", "setuptools_scm>=3.2.0"] | ||
|
||
hc_function = ('grid3d_hc_thickness=' | ||
'xtgeoapp_grd3dmaps.avghc.grid3d_hc_thickness:main') | ||
avg_function = ('grid3d_average_map=' | ||
'xtgeoapp_grd3dmaps.avghc.grid3d_average_map:main') | ||
con_function = ('grid3d_contact_map=' | ||
'xtgeoapp_grd3dmaps.contact.grd3d_contact_map:main') | ||
test_requirements = ["pytest"] | ||
|
||
hc_function = "grid3d_hc_thickness=" "xtgeoapp_grd3dmaps.avghc.grid3d_hc_thickness:main" | ||
avg_function = "grid3d_average_map=" "xtgeoapp_grd3dmaps.avghc.grid3d_average_map:main" | ||
|
||
|
||
setup( | ||
name='xtgeoapp_grd3dmaps', | ||
version=versioneer.get_version(), | ||
cmdclass=versioneer.get_cmdclass(), | ||
description='Make HC thickness, avg maps, etc directly from 3D props', | ||
long_description=readme + '\n\n' + history, | ||
author="Jan C. Rivenaes", | ||
author_email='[email protected]', | ||
url='https://github.com/Statoil/xtgeo-utils2', | ||
packages=find_packages('src'), | ||
package_dir={'': 'src'}, | ||
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')], | ||
entry_points={ | ||
'console_scripts': | ||
[hc_function, avg_function, con_function] | ||
name="xtgeoapp_grd3dmaps", | ||
use_scm_version={ | ||
"root": src(""), | ||
"write_to": src("src/xtgeoapp_grd3dmaps/_theversion.py"), | ||
}, | ||
|
||
description="Make HC thickness, avg maps, etc directly from 3D props", | ||
long_description=readme + "\n\n" + history, | ||
author="Equinor R&T", | ||
author_email="[email protected]", | ||
url="https://github.com/equinor/xtgeoapp_grd3dmaps", | ||
packages=find_packages("src"), | ||
package_dir={"": "src"}, | ||
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")], | ||
entry_points={"console_scripts": [hc_function, avg_function]}, | ||
include_package_data=True, | ||
install_requires=requirements, | ||
zip_safe=False, | ||
keywords='xtgeoapp_grd3dmaps', | ||
keywords="xtgeo", | ||
classifiers=[ | ||
'Development Status :: 2 - Pre-Alpha', | ||
'Intended Audience :: Developers', | ||
'Natural Language :: English', | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"Natural Language :: English", | ||
"Programming Language :: Python :: 2", | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.4', | ||
"Programming Language :: Python :: 2.7", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.4", | ||
"Programming Language :: Python :: 3.5", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
], | ||
test_suite='tests', | ||
test_suite="tests", | ||
tests_require=test_requirements, | ||
setup_requires=setup_requirements, | ||
) |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
"""The setup script.""" | ||
from glob import glob | ||
from os.path import basename | ||
from os.path import splitext | ||
|
||
from setuptools import setup, find_packages | ||
import versioneer | ||
|
||
with open('README.rst') as readme_file: | ||
readme = readme_file.read() | ||
|
||
with open('HISTORY.rst') as history_file: | ||
history = history_file.read() | ||
|
||
requirements = [ | ||
# TODO: put package requirements here | ||
] | ||
|
||
setup_requirements = [ | ||
'pytest-runner', | ||
# TODO(jriv): put setup requirements (distutils extensions, etc.) here | ||
] | ||
|
||
test_requirements = [ | ||
'pytest', | ||
# TODO: put package test requirements here | ||
] | ||
|
||
hc_function = ('grid3d_hc_thickness=' | ||
'xtgeoapp_grd3dmaps.avghc.grid3d_hc_thickness:main') | ||
avg_function = ('grid3d_average_map=' | ||
'xtgeoapp_grd3dmaps.avghc.grid3d_average_map:main') | ||
con_function = ('grid3d_contact_map=' | ||
'xtgeoapp_grd3dmaps.contact.grd3d_contact_map:main') | ||
|
||
|
||
setup( | ||
name='xtgeoapp_grd3dmaps', | ||
version=versioneer.get_version(), | ||
cmdclass=versioneer.get_cmdclass(), | ||
description='Make HC thickness, avg maps, etc directly from 3D props', | ||
long_description=readme + '\n\n' + history, | ||
author="Jan C. Rivenaes", | ||
author_email='[email protected]', | ||
url='https://github.com/Statoil/xtgeo-utils2', | ||
packages=find_packages('src'), | ||
package_dir={'': 'src'}, | ||
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')], | ||
entry_points={ | ||
'console_scripts': | ||
[hc_function, avg_function, con_function] | ||
}, | ||
|
||
include_package_data=True, | ||
install_requires=requirements, | ||
zip_safe=False, | ||
keywords='xtgeoapp_grd3dmaps', | ||
classifiers=[ | ||
'Development Status :: 2 - Pre-Alpha', | ||
'Intended Audience :: Developers', | ||
'Natural Language :: English', | ||
"Programming Language :: Python :: 2", | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Python :: 3.4', | ||
], | ||
test_suite='tests', | ||
tests_require=test_requirements, | ||
setup_requires=setup_requirements, | ||
) |
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,10 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
"""Top-level package for xtgeoapp_grd3dmaps""" | ||
|
||
__author__ = """Jan C. Rivenaes""" | ||
__email__ = '[email protected]' | ||
|
||
from ._version import get_versions | ||
__version__ = get_versions()['version'] | ||
del get_versions |
Oops, something went wrong.