Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,6 @@ doc/source/auto_examples/

# do not commit nose tests files
*.noseids

# no pip wheel metadata
pip-wheel-metadata/
26 changes: 0 additions & 26 deletions _updateversion.py

This file was deleted.

28 changes: 24 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import Cython as cth
from Cython.Distutils import build_ext
import numpy as np
# ...
import _updateversion as up
# ... for `clean` command
from distutils.command.clean import clean as Clean

Expand Down Expand Up @@ -142,9 +140,30 @@ def check_for_openmp(cc_var):


# == Getting tofu version =====================================================

_HERE = os.path.abspath(os.path.dirname(__file__))
def get_version_tofu(path=_HERE):


def updateversion(path=_HERE):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and no...
I agree having updateversion defined in a standalone side module is a bit cumbersome because it seems it is only needed in the setup.py.

But this was done in order to allow travis (or us) run updateversion as a standalone without having to import setup.py (which would run it).

updateversion can be useful as a standalone when we want to force an update of the version number prior to running the setup.py, using for example:

python -c "import _updateversion as up; out = up.updateversion(); print(out)"

This is not possible anymore with this change.

Are you sure there is no other fix for issue #292 ? It used to work before, I don't get why it stopped working

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, thanks for reviewing. So it seems this should not be merged as such.
I believe then this needs more investigation.
I have no idea why it's broken under Windows. Too bad...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice,
Please also make sure the PR does not include the chages from PR #292 (i.e.: updateversion)
These are two independent changes, and as we discussed, I'm sure sure we can merge PR #292 as of now.
I suspect it is because you created your branch from the branch you had already created for PR #292 , right ?

Best practice : always branch from devel, a world where things are stable and validated, to make small incremental changes ;-)

# Fetch version from git tags, and write to version.py
# Also, when git is not available (PyPi package), use stored version.py
version_py = os.path.join(path, "version.py")
try:
version_git = subprocess.check_output(["git",
"describe"]).rstrip().decode()
except:
with open(version_py, 'r') as fh:
version_git = fh.read().strip().split("=")[-1].replace("'", '')
version_git = version_git.lower().replace('v', '')

version_msg = "# Do not edit, pipeline versioning governed by git tags!"
with open(version_py, "w") as fh:
msg = "{0}__version__ = '{1}'{0}".format(os.linesep, version_git)
fh.write(version_msg + msg)
return version_git


def get_version_tofu(path=_HERE):
# Try from git
isgit = ".git" in os.listdir(path)
if isgit:
Expand All @@ -163,7 +182,7 @@ def get_version_tofu(path=_HERE):
.decode()
)
if git_branch in ["master"]:
version_tofu = up.updateversion(os.path.join(path, "tofu"))
version_tofu = updateversion(os.path.join(path, "tofu"))
else:
isgit = False
except Exception:
Expand All @@ -178,6 +197,7 @@ def get_version_tofu(path=_HERE):
version_tofu = version_tofu.lower().replace("v", "")
return version_tofu


version_tofu = get_version_tofu(path=_HERE)

print("")
Expand Down