Skip to content
This repository
Browse code

keep in zc.buildout branch 1.x

  • Loading branch information...
commit a601a901cefa2ccbae99b81c888fc38ba5bb79ed 1 parent 4a505cc
Héctor Velarde authored March 28, 2013

Showing 1 changed file with 22 additions and 7 deletions. Show diff stats Hide diff stats

  1. 29  bootstrap.py
29  bootstrap.py
@@ -136,10 +136,6 @@ def normalize_to_url(option, opt_str, value, parser):
136 136
 
137 137
 options, args = parser.parse_args()
138 138
 
139  
-# if -c was provided, we push it back into args for buildout's main function
140  
-if options.config_file is not None:
141  
-    args += ['-c', options.config_file]
142  
-
143 139
 if options.eggs:
144 140
     eggs_dir = os.path.abspath(os.path.expanduser(options.eggs))
145 141
 else:
@@ -152,8 +148,7 @@ def normalize_to_url(option, opt_str, value, parser):
152 148
         options.setup_source = setuptools_source
153 149
 
154 150
 if options.accept_buildout_test_releases:
155  
-    args.append('buildout:accept-buildout-test-releases=true')
156  
-args.append('bootstrap')
  151
+    args.insert(0, 'buildout:accept-buildout-test-releases=true')
157 152
 
158 153
 try:
159 154
     import pkg_resources
@@ -170,6 +165,8 @@ def normalize_to_url(option, opt_str, value, parser):
170 165
         setup_args['download_base'] = options.download_base
171 166
     if options.use_distribute:
172 167
         setup_args['no_fake'] = True
  168
+        if sys.version_info[:2] == (2, 4):
  169
+            setup_args['version'] = '0.6.32'
173 170
     ez['use_setuptools'](**setup_args)
174 171
     if 'pkg_resources' in sys.modules:
175 172
         reload(sys.modules['pkg_resources'])
@@ -192,6 +189,8 @@ def normalize_to_url(option, opt_str, value, parser):
192 189
 find_links = options.download_base
193 190
 if not find_links:
194 191
     find_links = os.environ.get('bootstrap-testing-find-links')
  192
+if not find_links and options.accept_buildout_test_releases:
  193
+    find_links = 'http://downloads.buildout.org/'
195 194
 if find_links:
196 195
     cmd.extend(['-f', quote(find_links)])
197 196
 
@@ -228,6 +227,8 @@ def _final_version(parsed_version):
228 227
         bestv = None
229 228
         for dist in index[req.project_name]:
230 229
             distv = dist.parsed_version
  230
+            if distv >= pkg_resources.parse_version('2dev'):
  231
+                continue
231 232
             if _final_version(distv):
232 233
                 if bestv is None or distv > bestv:
233 234
                     best = [dist]
@@ -237,8 +238,12 @@ def _final_version(parsed_version):
237 238
         if best:
238 239
             best.sort()
239 240
             version = best[-1].version
  241
+
240 242
 if version:
241  
-    requirement = '=='.join((requirement, version))
  243
+    requirement += '=='+version
  244
+else:
  245
+    requirement += '<2dev'
  246
+
242 247
 cmd.append(requirement)
243 248
 
244 249
 if is_jython:
@@ -257,6 +262,16 @@ def _final_version(parsed_version):
257 262
 ws.add_entry(eggs_dir)
258 263
 ws.require(requirement)
259 264
 import zc.buildout.buildout
  265
+
  266
+# If there isn't already a command in the args, add bootstrap
  267
+if not [a for a in args if '=' not in a]:
  268
+    args.append('bootstrap')
  269
+
  270
+
  271
+# if -c was provided, we push it back into args for buildout's main function
  272
+if options.config_file is not None:
  273
+    args[0:0] = ['-c', options.config_file]
  274
+
260 275
 zc.buildout.buildout.main(args)
261 276
 if not options.eggs:  # clean up temporary egg directory
262 277
     shutil.rmtree(eggs_dir)

0 notes on commit a601a90

Please sign in to comment.
Something went wrong with that request. Please try again.