Skip to content

Commit

Permalink
Fix issue cylc#2997 simplify cylc version
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno P. Kinoshita committed Mar 13, 2019
1 parent e2b81ef commit 2591d5e
Show file tree
Hide file tree
Showing 16 changed files with 15 additions and 143 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ doc/built-sphinx-single/
# - Installed docs
doc/install/

# VERSION FILE
VERSION

# vim backup files
*.swp

Expand Down
22 changes: 2 additions & 20 deletions bin/cylc
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,8 @@ CATEGORIES=('control' 'con' 'information' 'info' 'all' 'task' 'license' \
HELP_OPTS=('help' '--help' '-h' 'h' '?')

get_version() {
# If there is a version file present, use that
if [[ -f "${CYLC_DIR}/VERSION" ]]; then
CYLC_VERSION="$(cat "${CYLC_DIR}/VERSION")"
# Otherwise, use git (if in a git repo and not a bare clone)
# to determine version
elif git --git-dir "${CYLC_DIR}/.git" rev-parse && \
[[ -n "$(git --git-dir "${CYLC_DIR}/.git" rev-parse \
--show-toplevel)" ]]; then
CYLC_VERSION="$(cd "${CYLC_DIR}" && git describe --abbrev=4 --always)"
# Append "-dirty" if there are uncommitted changes.
if [[ -n "$(cd "${CYLC_DIR}" && git status \
--untracked-files=no --porcelain)" ]]; then
CYLC_VERSION="${CYLC_VERSION}-dirty"
fi
# Else we must be in a standalone cylc folder/tarball with no verion info.
# (make has not yet been run)
else
echo "No version is set, cylc must be built first. Aborting..." >&2
exit 1
fi
CYLC_VERSION="$(python -c "from cylc import __version__;\
print(__version__)")"
}

print_version() {
Expand Down
2 changes: 1 addition & 1 deletion bin/cylc-check-versions
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ from time import sleep

import cylc.flags
from cylc.option_parsers import CylcOptionParser as COP
from cylc.version import CYLC_VERSION
from cylc import __version__ as CYLC_VERSION
from cylc.config import SuiteConfig
from cylc.subprocpool import SuiteProcPool
from cylc.suite_srv_files_mgr import SuiteSrvFilesManager
Expand Down
2 changes: 1 addition & 1 deletion bin/cylc-help
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import sys

# Import cylc to initialise CYLC_DIR and the path for python (__init__.py).
from cylc.version import CYLC_VERSION
from cylc import __version__ as CYLC_VERSION


class CommandError(Exception):
Expand Down
1 change: 0 additions & 1 deletion bin/cylc-submit
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ from cylc.task_events_mgr import TaskEventsManager
from cylc.task_proxy import TaskProxy
from cylc.task_state import TASK_STATUS_SUBMIT_FAILED
from cylc.templatevars import load_template_vars
import cylc.version # Ensures '$CYLC_VERSION' is set.


def main():
Expand Down
2 changes: 1 addition & 1 deletion bin/cylc-validate
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ from cylc import LOG
import cylc.flags
from cylc.option_parsers import CylcOptionParser as COP
from cylc.loggingutil import CylcLogFormatter
from cylc.version import CYLC_VERSION
from cylc import __version__ as CYLC_VERSION
from cylc.config import SuiteConfig, SuiteConfigError
from cylc.prerequisite import TriggerExpressionError
from cylc.suite_srv_files_mgr import SuiteSrvFilesManager
Expand Down
14 changes: 0 additions & 14 deletions etc/dev-bin/create-version-file

This file was deleted.

41 changes: 0 additions & 41 deletions etc/dev-bin/get-repo-version

This file was deleted.

2 changes: 2 additions & 0 deletions lib/cylc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,5 @@ def environ_path_add(dirs, key='PATH'):


environ_init()

__version__ = "8.0.0-a0"
2 changes: 1 addition & 1 deletion lib/cylc/cfgspec/globalcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
cylc_config_validate, CylcConfigValidator as VDR, DurationFloat)
from cylc.hostuserutil import get_user_home, is_remote_user
from cylc.network import Priv
from cylc.version import CYLC_VERSION
from cylc import __version__ as CYLC_VERSION

# Nested dict of spec items.
# Spec value is [value_type, default, allowed_2, allowed_3, ...]
Expand Down
4 changes: 3 additions & 1 deletion lib/cylc/job_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import stat
from subprocess import Popen, PIPE

from cylc import __version__ as CYLC_VERSION
from cylc.batch_sys_manager import BatchSysManager
from cylc.cfgspec.glbl_cfg import glbl_cfg
import cylc.flags
Expand Down Expand Up @@ -158,7 +159,8 @@ def _write_prelude(self, handle, job_conf):
handle.write("\nexport CYLC_DIR='%s'" % (os.environ['CYLC_DIR']))
if cylc.flags.debug:
handle.write("\nexport CYLC_DEBUG=true")
for key in ['CYLC_VERSION'] + self._get_host_item(
handle.write("\nexport CYLC_VERSION='%s'" % CYLC_VERSION)
for key in self._get_host_item(
job_conf, 'copyable environment variables'):
if key in os.environ:
handle.write("\nexport %s='%s'" % (key, os.environ[key]))
Expand Down
2 changes: 1 addition & 1 deletion lib/cylc/network/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from cylc.suite_status import (
KEY_META, KEY_NAME, KEY_OWNER, KEY_STATES,
KEY_TASKS_BY_STATE, KEY_UPDATE_TIME, KEY_VERSION)
from cylc.version import CYLC_VERSION
from cylc import __version__ as CYLC_VERSION


class ZMQServer(object):
Expand Down
2 changes: 1 addition & 1 deletion lib/cylc/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from cylc.cfgspec.glbl_cfg import glbl_cfg
import cylc.flags
from cylc.hostuserutil import is_remote
from cylc.version import CYLC_VERSION
from cylc import __version__ as CYLC_VERSION


def get_proc_ancestors():
Expand Down
2 changes: 1 addition & 1 deletion lib/cylc/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
from cylc.task_state import (
TASK_STATUSES_ACTIVE, TASK_STATUSES_NEVER_ACTIVE, TASK_STATUS_FAILED)
from cylc.templatevars import load_template_vars
from cylc.version import CYLC_VERSION
from cylc import __version__ as CYLC_VERSION
from cylc.wallclock import (
get_current_time_string, get_seconds_as_interval_string,
get_time_string_from_unix_time as time2str, get_utc_mode)
Expand Down
2 changes: 1 addition & 1 deletion lib/cylc/suite_db_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from cylc import LOG
from cylc.broadcast_report import get_broadcast_change_iter
from cylc.rundb import CylcSuiteDAO
from cylc.version import CYLC_VERSION
from cylc import __version__ as CYLC_VERSION
from cylc.wallclock import get_current_time_string, get_utc_mode


Expand Down
55 changes: 0 additions & 55 deletions lib/cylc/version.py

This file was deleted.

0 comments on commit 2591d5e

Please sign in to comment.