diff --git a/.dockerignore b/.dockerignore index ce9b6842..44e3f441 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,3 +7,5 @@ data *.md *.egg-info/ .circleci/ +docs/ +examples/ diff --git a/.neurodocker.json b/.neurodocker.json index 149ed8f0..90a328f9 100644 --- a/.neurodocker.json +++ b/.neurodocker.json @@ -63,16 +63,6 @@ "user", "root" ], - [ - "arg", - { - "VERSION": "" - } - ], - [ - "run", - "echo \"$VERSION\" > /src/fitlins/fitlins/VERSION" - ], [ "run", "mkdir /work && chown -R neuro /src /work && chmod a+w /work" @@ -82,21 +72,21 @@ "neuro" ], [ - "miniconda", + "arg", { - "use_env": "neuro", - "pip_opts": "-r", - "pip_install": [ - "/src/fitlins/requirements.txt" - ] + "VERSION": "" } ], + [ + "run", + "echo \"$VERSION\" > /src/fitlins/VERSION" + ], [ "miniconda", { "use_env": "neuro", "pip_install": [ - "/src/fitlins[all,test]" + "/src/fitlins[all]" ], "activate": true } diff --git a/Dockerfile b/Dockerfile index 51c8d62c..d1674c34 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Generated by Neurodocker version 0.5.0 -# Timestamp: 2019-05-02 14:00:04 UTC +# Timestamp: 2019-05-09 20:10:42 UTC # # Thank you for using Neurodocker. If you discover any issues # or ways to improve this software, please submit an issue or @@ -86,23 +86,17 @@ COPY [".", "/src/fitlins"] USER root -ARG VERSION - -RUN echo "$VERSION" > /src/fitlins/fitlins/VERSION - RUN mkdir /work && chown -R neuro /src /work && chmod a+w /work USER neuro -RUN bash -c "source activate neuro \ - && pip install --no-cache-dir -r \ - '/src/fitlins/requirements.txt'" \ - && rm -rf ~/.cache/pip/* \ - && sync +ARG VERSION + +RUN echo "$VERSION" > /src/fitlins/VERSION RUN bash -c "source activate neuro \ && pip install --no-cache-dir \ - '/src/fitlins[all,test]'" \ + '/src/fitlins[all]'" \ && rm -rf ~/.cache/pip/* \ && sync \ && sed -i '$isource activate neuro' $ND_ENTRYPOINT @@ -189,16 +183,6 @@ RUN echo '{ \ \n "root" \ \n ], \ \n [ \ - \n "arg", \ - \n { \ - \n "VERSION": "" \ - \n } \ - \n ], \ - \n [ \ - \n "run", \ - \n "echo \"$VERSION\" > /src/fitlins/fitlins/VERSION" \ - \n ], \ - \n [ \ \n "run", \ \n "mkdir /work && chown -R neuro /src /work && chmod a+w /work" \ \n ], \ @@ -207,21 +191,21 @@ RUN echo '{ \ \n "neuro" \ \n ], \ \n [ \ - \n "miniconda", \ + \n "arg", \ \n { \ - \n "use_env": "neuro", \ - \n "pip_opts": "-r", \ - \n "pip_install": [ \ - \n "/src/fitlins/requirements.txt" \ - \n ] \ + \n "VERSION": "" \ \n } \ \n ], \ \n [ \ + \n "run", \ + \n "echo \"$VERSION\" > /src/fitlins/VERSION" \ + \n ], \ + \n [ \ \n "miniconda", \ \n { \ \n "use_env": "neuro", \ \n "pip_install": [ \ - \n "/src/fitlins[all,test]" \ + \n "/src/fitlins[all]" \ \n ], \ \n "activate": true \ \n } \ diff --git a/MANIFEST.in b/MANIFEST.in index c93ec425..90b206fc 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include versioneer.py -include fitlins/_version.py -include fitlins/VERSION +include fitlins/data/*.json +include fitlins/data/*.tpl diff --git a/fitlins/_version.py b/fitlins/_version.py index 44e3a73c..f540fd09 100644 --- a/fitlins/_version.py +++ b/fitlins/_version.py @@ -15,6 +15,7 @@ import re import subprocess import sys +from pathlib import Path def get_keywords(): @@ -483,10 +484,9 @@ def get_versions(): cfg = get_config() verbose = cfg.verbose - root_dir = os.path.dirname(__file__) - if os.path.isfile(os.path.join(root_dir, 'VERSION')): - with open(os.path.join(root_dir, 'VERSION')) as vfile: - version = vfile.readline().strip() + ver_file = Path(__file__).parent.parent / 'VERSION' + if ver_file.is_file(): + version = ver_file.read_text().splitlines()[0].strip() return { "version": version, diff --git a/setup.cfg b/setup.cfg index 65e9a8b1..2359e9a2 100644 --- a/setup.cfg +++ b/setup.cfg @@ -36,13 +36,16 @@ install_requires = [options.extras_require] duecredit = duecredit test = coverage -all = duecredit docs = sphinx sphinxcontrib-apidoc sphinx-argparse texext m2r +all = + %(docs)s + %(duecredit)s + %(test)s [options.entry_points] console_scripts = @@ -53,6 +56,10 @@ fitlins = data/*.json data/*.tpl +[options.exclude_package_data] +* = + examples + [versioneer] VCS = git style = pep440 diff --git a/setup.py b/setup.py index e9be1d60..df216b72 100644 --- a/setup.py +++ b/setup.py @@ -6,27 +6,13 @@ def main(): """ Install entry-point """ - import os - from inspect import getfile, currentframe - from fitlins.__about__ import ( - DOWNLOAD_URL, - ) - - root_dir = os.path.dirname(os.path.abspath(getfile(currentframe()))) - - version = None - cmdclass = {} - if os.path.isfile(os.path.join(root_dir, 'fitlins', 'VERSION')): - with open(os.path.join(root_dir, 'fitlins', 'VERSION')) as vfile: - version = vfile.readline().strip() + import versioneer + from fitlins.__about__ import __version__, DOWNLOAD_URL - if version is None: - import versioneer - version = versioneer.get_version() - cmdclass = versioneer.get_cmdclass() + cmdclass = versioneer.get_cmdclass() setup( - version=version, + version=__version__, cmdclass=cmdclass, download_url=DOWNLOAD_URL, ) diff --git a/versioneer.py b/versioneer.py index 64fea1c8..88c6baea 100644 --- a/versioneer.py +++ b/versioneer.py @@ -287,6 +287,7 @@ import re import subprocess import sys +from pathlib import Path class VersioneerConfig: @@ -1404,6 +1405,12 @@ def get_versions(verbose=False): Returns dict with two keys: 'version' and 'full'. """ + ver_file = Path(__file__).parent / 'VERSION' + + if ver_file.is_file(): + ver = ver_file.read_text().splitlines()[0].strip() + return {"version": ver, 'full': ver} + if "versioneer" in sys.modules: # see the discussion in cmdclass.py:get_cmdclass() del sys.modules["versioneer"]