Skip to content

Commit

Permalink
version
Browse files Browse the repository at this point in the history
  • Loading branch information
fzimmermann89 committed Apr 21, 2021
1 parent 6b7a596 commit 4fdf79f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=$(echo $GITHUB_REF | sed 's#refs/tags/##')
echo "$VERSION"
PLACEHOLDER="develop"
VERSION_FILE='idi/__init__.py'
grep "__version__.*$PLACEHOLDER" "$VERSION_FILE"
sed -Ei "s/(__version__ ?=.*)-$PLACEHOLDER/\1-$VERSION/g" "$VERSION_FILE"
sed -E -i'.original' -e "s/(__version__ ?=.*)\+$PLACEHOLDER/\1\+$VERSION/g" "$VERSION_FILE"
cat "$VERSION_FILE"
shell: bash

Expand Down Expand Up @@ -64,11 +63,10 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=$(echo $GITHUB_REF | sed 's#refs/tags/##')
echo "$VERSION"
PLACEHOLDER="develop"
VERSION_FILE='idi/__init__.py'
grep "__version__.*$PLACEHOLDER" "$VERSION_FILE"
sed -Ei "s/(__version__ ?=.*)-$PLACEHOLDER/\1-$VERSION/g" "$VERSION_FILE"
sed -E -i'.original' -e "s/(__version__ ?=.*)\+$PLACEHOLDER/\1\+$VERSION/g" "$VERSION_FILE"
cat "$VERSION_FILE"
shell: bash

Expand Down Expand Up @@ -134,11 +132,10 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION=$(echo $GITHUB_REF | sed 's#refs/tags/##')
echo "$VERSION"
PLACEHOLDER="develop"
VERSION_FILE='idi/__init__.py'
grep "__version__.*$PLACEHOLDER" "$VERSION_FILE"
sed -Ei "s/(__version__ ?=.*)-$PLACEHOLDER/\1-$VERSION/g" "$VERSION_FILE"
sed -E -i'.original' -e "s/(__version__ ?=.*)\+$PLACEHOLDER/\1\+$VERSION/g" "$VERSION_FILE"
cat "$VERSION_FILE"
shell: bash

Expand Down
2 changes: 1 addition & 1 deletion idi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "0.0.0-develop"
__version__ = "0.0.0+develop"
__all__ = ['reconstruction', 'simulation', 'util']
# from . import simulation,reconstruction
22 changes: 17 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def configuration():
from collections import OrderedDict
import numpy

config = Configuration("idi", "")
config = Configuration("idi","")
srcdir = join(dirname(realpath(__file__)), "idi")
mkl_info = get_info("mkl")
basedirs = list(
Expand Down Expand Up @@ -113,11 +113,24 @@ def configuration():
return config


def get_version(rel_path):
import os.path
import codecs

here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), "r") as fp:
for line in fp.read().splitlines():
if line.startswith("__version__"):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
raise RuntimeError("Unable to find version string.")


def setup_package():
from numpy.distutils.core import setup
import idi as app


metadata = dict(
version=get_version("idi/__init__.py"),
maintainer="zimmf",
description="idi simulation and reconstruction",
platforms=["Linux", "Mac OS-X"],
Expand All @@ -136,10 +149,9 @@ def setup_package():
"mkl-include",
],
package_data={"": ["*.cu"]},
version=app.__version__,
scripts=["scripts/idi_sim.py", "scripts/idi_simrecon.py"],
configuration=configuration,
test_suite="tests",
**configuration().todict()
)
setup(**metadata)

Expand Down

0 comments on commit 4fdf79f

Please sign in to comment.