update to cutarelease 1.0.7 for JS version marker fix
This commit is contained in:
parent
80c009a0d7
commit
ff3786f7d6
1 changed files with 22 additions and 10 deletions
|
@ -13,7 +13,7 @@ Conventions:
|
||||||
- XXX
|
- XXX
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version_info__ = (1, 0, 6)
|
__version_info__ = (1, 0, 7)
|
||||||
__version__ = '.'.join(map(str, __version_info__))
|
__version__ = '.'.join(map(str, __version_info__))
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -213,10 +213,21 @@ def cutarelease(project_name, version_files, dry_run=False):
|
||||||
ver_content = ver_content.replace(marker,
|
ver_content = ver_content.replace(marker,
|
||||||
'"version": "%s"' % next_version)
|
'"version": "%s"' % next_version)
|
||||||
elif ver_file_type == "javascript":
|
elif ver_file_type == "javascript":
|
||||||
marker = 'var VERSION = "%s";' % version
|
candidates = [
|
||||||
if marker not in ver_content:
|
("single", "var VERSION = '%s';" % version),
|
||||||
raise Error("couldn't find `%s' version marker in `%s' "
|
("double", 'var VERSION = "%s";' % version),
|
||||||
"content: can't prep for subsequent dev" % (marker, ver_file))
|
]
|
||||||
|
for quote_type, marker in candidates:
|
||||||
|
if marker in ver_content:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise Error("couldn't find any candidate version marker in "
|
||||||
|
"`%s' content: can't prep for subsequent dev: %r"
|
||||||
|
% (ver_file, candidates))
|
||||||
|
if quote_type == "single":
|
||||||
|
ver_content = ver_content.replace(marker,
|
||||||
|
"var VERSION = '%s';" % next_version)
|
||||||
|
else:
|
||||||
ver_content = ver_content.replace(marker,
|
ver_content = ver_content.replace(marker,
|
||||||
'var VERSION = "%s";' % next_version)
|
'var VERSION = "%s";' % next_version)
|
||||||
elif ver_file_type == "python":
|
elif ver_file_type == "python":
|
||||||
|
@ -299,7 +310,8 @@ def _parse_version_file(version_file):
|
||||||
Supported version file types (i.e. types of files from which we know
|
Supported version file types (i.e. types of files from which we know
|
||||||
how to parse the version string/number -- often by some convention):
|
how to parse the version string/number -- often by some convention):
|
||||||
- json: use the "version" key
|
- json: use the "version" key
|
||||||
- javascript: look for a `var VERSION = "1.2.3";`
|
- javascript: look for a `var VERSION = "1.2.3";` or
|
||||||
|
`var VERSION = '1.2.3';`
|
||||||
- python: Python script/module with `__version_info__ = (1, 2, 3)`
|
- python: Python script/module with `__version_info__ = (1, 2, 3)`
|
||||||
- version: a VERSION.txt or VERSION file where the whole contents are
|
- version: a VERSION.txt or VERSION file where the whole contents are
|
||||||
the version string
|
the version string
|
||||||
|
@ -353,8 +365,8 @@ def _parse_version_file(version_file):
|
||||||
m = re.search(r'^__version_info__ = (.*?)$', content, re.M)
|
m = re.search(r'^__version_info__ = (.*?)$', content, re.M)
|
||||||
version_info = eval(m.group(1))
|
version_info = eval(m.group(1))
|
||||||
elif version_file_type == "javascript":
|
elif version_file_type == "javascript":
|
||||||
m = re.search(r'^var VERSION = "(.*?)";$', content, re.M)
|
m = re.search(r'^var VERSION = (\'|")(.*?)\1;$', content, re.M)
|
||||||
version_info = _version_info_from_version(m.group(1))
|
version_info = _version_info_from_version(m.group(2))
|
||||||
elif version_file_type == "version":
|
elif version_file_type == "version":
|
||||||
version_info = _version_info_from_version(content.strip())
|
version_info = _version_info_from_version(content.strip())
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue