Skip to content

Instantly share code, notes, and snippets.

@aodj
Last active August 29, 2015 14:05
Show Gist options
  • Save aodj/46bfa72fb5faaaf23e45 to your computer and use it in GitHub Desktop.
Save aodj/46bfa72fb5faaaf23e45 to your computer and use it in GitHub Desktop.
step #4
:: extract source
call bsdtar.exe xvzf virtualenv-1.11.6.tar.gz
:: switch directories
cd virtualenv-1.11.6
:: make the virtualenv
python virtualenv.py ..\%1
:: install the dependencies
:: http://www.robvanderwoude.com/ntregistry.php
echo Checking registry for existing Python install path under "HKCU\Software\Python\PythonCore\2.7\InstallPath"
:: query the registry, parse it's output and if we get anything, save it as %installpath%
:: delims is a TAB followed by a space
for /f "tokens=2* delims= " %%A in ('reg query "HKCU\Software\Python\PythonCore\2.7\InstallPath"') do set installpath=%%B
:: if we've got a value in %installpath%, save it out to disk for restoration later
if not "%installpath%"=="" call reg export "HKCU\Software\Python\PythonCore\2.7\InstallPath" installpath.reg && echo Found existing InstallPath, saving to installpath.reg
:: update the registry with the path to our virtualenv
echo Updating "HKCU\Software\Python\PythonCore\2.7\InstallPath" from "%installpath%" to "%cd%\%1"
call reg add "HKCU\Software\Python\PythonCore\2.7\InstallPath" /d %cd%\%1 /f
:: now run the wxpython installer
echo Installing wxPython3.0-win32-3.0.0.0-py27
call wxPython3.0-win32-3.0.0.0-py27.exe /VERYSILENT /SUPPRESSMSGBOXES /LOG=wxpythoninstall.log /DIR=%1\Lib\site-packages
:: add in the missing wx.pth file
echo Creating wx.pth
echo wx-3.0-msw > %1\Lib\site-packages\wx.pth
cd %1\Scripts
call easy_install pywin32-214.win32-py2.7.exe
call easy_install py2exe-0.6.9.win32-py2.7.exe
call pip install -r requirements.txt
:: do some cleanup
cd ..\..
rmdir /S /Q virtualenv-1.11.6
:: reinstall the old reg key if we saved one out
if not "%installpath%"=="" echo Reverting "HKCU\Software\Python\PythonCore\2.7\InstallPath" && call reg import installpath.reg && del installpath.reg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment