Skip to content

Commit

Permalink
MAINT: Update versioning for pip, Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed May 10, 2019
1 parent 224db12 commit e3d59df
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 70 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ data
*.md
*.egg-info/
.circleci/
docs/
examples/
24 changes: 7 additions & 17 deletions .neurodocker.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}
Expand Down
40 changes: 12 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ], \
Expand All @@ -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 } \
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include versioneer.py
include fitlins/_version.py
include fitlins/VERSION
include fitlins/data/*.json
include fitlins/data/*.tpl
8 changes: 4 additions & 4 deletions fitlins/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import re
import subprocess
import sys
from pathlib import Path


def get_keywords():
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 8 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -53,6 +56,10 @@ fitlins =
data/*.json
data/*.tpl

[options.exclude_package_data]
* =
examples

[versioneer]
VCS = git
style = pep440
Expand Down
22 changes: 4 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
7 changes: 7 additions & 0 deletions versioneer.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@
import re
import subprocess
import sys
from pathlib import Path


class VersioneerConfig:
Expand Down Expand Up @@ -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"]
Expand Down

0 comments on commit e3d59df

Please sign in to comment.