Adding local virtualenv setup on Windows and defaulting to -j1.
This commit is contained in:
		
							parent
							
								
									4f8e3e3713
								
							
						
					
					
						commit
						1017637063
					
				|  | @ -0,0 +1,4 @@ | ||||||
|  | @ECHO OFF | ||||||
|  | 
 | ||||||
|  | SET DIR=%~dp0 | ||||||
|  | python %DIR%\anvil\manage.py %* | ||||||
|  | @ -8,6 +8,7 @@ __author__ = 'benvanik@google.com (Ben Vanik)' | ||||||
| 
 | 
 | ||||||
| import os | import os | ||||||
| import shutil | import shutil | ||||||
|  | import sys | ||||||
| 
 | 
 | ||||||
| from anvil.cache import RuleCache, FileRuleCache | from anvil.cache import RuleCache, FileRuleCache | ||||||
| from anvil.context import BuildEnvironment, BuildContext | from anvil.context import BuildEnvironment, BuildContext | ||||||
|  | @ -63,8 +64,13 @@ def run_build(cwd, parsed_args): | ||||||
|   project = Project(module_resolver=module_resolver) |   project = Project(module_resolver=module_resolver) | ||||||
| 
 | 
 | ||||||
|   # -j/--jobs switch to change execution mode |   # -j/--jobs switch to change execution mode | ||||||
|   # TODO(benvanik): re-enable when multiprocessing works |  | ||||||
|   #task_executor = None |   #task_executor = None | ||||||
|  |   if parsed_args.jobs is None: | ||||||
|  |     # Default to -j1 on Windows only. | ||||||
|  |     # TODO(benvanik): figure out why this fails so catastrophically | ||||||
|  |     if (sys.platform == 'cygwin' or | ||||||
|  |         sys.platform == 'win32'): | ||||||
|  |       parsed_args.jobs = 1 | ||||||
|   if parsed_args.jobs == 1: |   if parsed_args.jobs == 1: | ||||||
|     task_executor = InProcessTaskExecutor() |     task_executor = InProcessTaskExecutor() | ||||||
|   else: |   else: | ||||||
|  |  | ||||||
|  | @ -0,0 +1,39 @@ | ||||||
|  | @ECHO OFF | ||||||
|  | 
 | ||||||
|  | REM Copyright 2012 Google Inc. All Rights Reserved. | ||||||
|  | REM | ||||||
|  | REM wtf Windows setup script | ||||||
|  | REM Sets up a local virtualenv for anvil. | ||||||
|  | REM This places all dependencies within the anvil-build/ path such that nothing | ||||||
|  | REM from site-packages is used. In order to make use of this consumers should | ||||||
|  | REM invoke anvil-local.bat instead of the global 'anvil'. | ||||||
|  | 
 | ||||||
|  | SET DIR=%~dp0 | ||||||
|  | 
 | ||||||
|  | REM Visual Studio 2010 | ||||||
|  | SET VS90COMNTOOLS=%VS100COMNTOOLS% | ||||||
|  | REM Visual Studio 2012 | ||||||
|  | REM SET VS90COMNTOOLS=%VS110COMNTOOLS% | ||||||
|  | 
 | ||||||
|  | ECHO Installing virtualenv (1.8.2)... | ||||||
|  | 
 | ||||||
|  | pip install virtualenv==1.8.2 | ||||||
|  | 
 | ||||||
|  | ECHO Setting up the virtual environment... | ||||||
|  | 
 | ||||||
|  | virtualenv %DIR%\local_virtualenv | ||||||
|  | 
 | ||||||
|  | ECHO Preparing virtualenv... | ||||||
|  | 
 | ||||||
|  | REM Instead of using active we need to do it manually - the Windows | ||||||
|  | REM activate script doesn't return control back to this script when run. | ||||||
|  | SET VIRTUAL_ENV=%DIR%\local_virtualenv | ||||||
|  | SET PATH=%VIRTUAL_ENV%\Scripts;%PATH% | ||||||
|  | REM %DIR%\local_virtualenv\Scripts\activate | ||||||
|  | 
 | ||||||
|  | ECHO Repeatedly installing twisted, as python still doesn't support VS2010... | ||||||
|  | FOR %%A IN (1 2 3 4 5) DO pip install twisted | ||||||
|  | 
 | ||||||
|  | ECHO Installing anvil-build... | ||||||
|  | cd %DIR% | ||||||
|  | python setup.py develop | ||||||
		Loading…
	
		Reference in New Issue