diff --git a/anvil-local.bat b/anvil-local.bat new file mode 100644 index 0000000..262f282 --- /dev/null +++ b/anvil-local.bat @@ -0,0 +1,4 @@ +@ECHO OFF + +SET DIR=%~dp0 +python %DIR%\anvil\manage.py %* diff --git a/anvil/commands/util.py b/anvil/commands/util.py index 45e3e6a..48072ac 100644 --- a/anvil/commands/util.py +++ b/anvil/commands/util.py @@ -8,6 +8,7 @@ __author__ = 'benvanik@google.com (Ben Vanik)' import os import shutil +import sys from anvil.cache import RuleCache, FileRuleCache from anvil.context import BuildEnvironment, BuildContext @@ -63,8 +64,13 @@ def run_build(cwd, parsed_args): project = Project(module_resolver=module_resolver) # -j/--jobs switch to change execution mode - # TODO(benvanik): re-enable when multiprocessing works #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: task_executor = InProcessTaskExecutor() else: diff --git a/setup-local.bat b/setup-local.bat new file mode 100644 index 0000000..95a3c14 --- /dev/null +++ b/setup-local.bat @@ -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