Commit f598679c authored by Jim Fulton's avatar Jim Fulton

Woo hoo! We don't need the special windows restart on update anymore!

This is weird, platform.python_version_tuple() returns a tuple of ints
on Python 2.6 on windows.
parent 49a69ddd
...@@ -146,13 +146,11 @@ _buildout_default_options = _annotate_section({ ...@@ -146,13 +146,11 @@ _buildout_default_options = _annotate_section({
class Buildout(DictMixin): class Buildout(DictMixin):
def __init__(self, config_file, cloptions, def __init__(self, config_file, cloptions,
user_defaults=True, windows_restart=False, user_defaults=True,
command=None, args=()): command=None, args=()):
__doing__ = 'Initializing.' __doing__ = 'Initializing.'
self.__windows_restart = windows_restart
# default options # default options
data = dict(buildout=_buildout_default_options.copy()) data = dict(buildout=_buildout_default_options.copy())
self._buildout_dir = os.getcwd() self._buildout_dir = os.getcwd()
...@@ -915,14 +913,6 @@ class Buildout(DictMixin): ...@@ -915,14 +913,6 @@ class Buildout(DictMixin):
"buildout command.") "buildout command.")
return return
if sys.platform == 'win32' and not self.__windows_restart:
args = list(map(zc.buildout.easy_install._safe_arg, sys.argv))
args.insert(1, '-W')
if not __debug__:
args.insert(0, '-O')
args.insert(0, zc.buildout.easy_install._safe_arg (sys.executable))
os.execv(sys.executable, args)
self._logger.info("Upgraded:\n %s;\nrestarting.", self._logger.info("Upgraded:\n %s;\nrestarting.",
",\n ".join([("%s version %s" ",\n ".join([("%s version %s"
% (dist.project_name, dist.version) % (dist.project_name, dist.version)
...@@ -1475,7 +1465,7 @@ def _default_globals(): ...@@ -1475,7 +1465,7 @@ def _default_globals():
globals_defs = {'sys': sys, 'os': os, 'platform': platform, 're': re,} globals_defs = {'sys': sys, 'os': os, 'platform': platform, 're': re,}
# major python major_python_versions as python2 and python3 # major python major_python_versions as python2 and python3
major_python_versions = platform.python_version_tuple() major_python_versions = map(str, platform.python_version_tuple())
globals_defs.update({'python2': major_python_versions[0] == '2', globals_defs.update({'python2': major_python_versions[0] == '2',
'python3': major_python_versions[0] == '3'}) 'python3': major_python_versions[0] == '3'})
...@@ -1844,7 +1834,6 @@ def main(args=None): ...@@ -1844,7 +1834,6 @@ def main(args=None):
config_file = 'buildout.cfg' config_file = 'buildout.cfg'
verbosity = 0 verbosity = 0
options = [] options = []
windows_restart = False
user_defaults = True user_defaults = True
debug = False debug = False
while args: while args:
...@@ -1856,8 +1845,6 @@ def main(args=None): ...@@ -1856,8 +1845,6 @@ def main(args=None):
verbosity += 10 verbosity += 10
elif op[0] == 'q': elif op[0] == 'q':
verbosity -= 10 verbosity -= 10
elif op[0] == 'W':
windows_restart = True
elif op[0] == 'U': elif op[0] == 'U':
user_defaults = False user_defaults = False
elif op[0] == 'o': elif op[0] == 'o':
...@@ -1932,8 +1919,7 @@ def main(args=None): ...@@ -1932,8 +1919,7 @@ def main(args=None):
try: try:
try: try:
buildout = Buildout(config_file, options, buildout = Buildout(config_file, options,
user_defaults, windows_restart, user_defaults, command, args)
command, args)
getattr(buildout, command)(args) getattr(buildout, command)(args)
except SystemExit: except SystemExit:
logging.shutdown() logging.shutdown()
......
...@@ -285,7 +285,7 @@ objects made available to the evaluation context of the expression. Here we add ...@@ -285,7 +285,7 @@ objects made available to the evaluation context of the expression. Here we add
the platform and sys modules to the evaluation context, so we can access the platform and sys modules to the evaluation context, so we can access
platform and sys modules functions and objects in our expressions :: platform and sys modules functions and objects in our expressions ::
[s1: platform.python_version_tuple()[0] in ('2', '3',)] # this expression is true, the major versions of python are either 2 or 3 [s1: str(platform.python_version_tuple()[0]) in ('2', '3',)] # this expression is true, the major versions of python are either 2 or 3
a = 1 a = 1
[s2:sys.version[0] == '0'] # comment: this expression "is false", there no major version 0 of Python so this section will be ignored [s2:sys.version[0] == '0'] # comment: this expression "is false", there no major version 0 of Python so this section will be ignored
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment