Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite virtualenv #697

Closed
wants to merge 78 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
5bf9237
Move the virtualenv.py to virtualenv-legacy.py
dstufft Dec 24, 2014
609f033
Create the click parser and command function
dstufft Dec 24, 2014
f9955bc
Lay down the begining of an API for building environments
dstufft Dec 24, 2014
0645cb0
Get the basic workings of creating a venv style virtual environment
dstufft Dec 24, 2014
4c4022e
Add a hook we'll eventually use to install the activate scripts
dstufft Dec 25, 2014
769acd7
Install pip and setuptools into the virtual environment
dstufft Dec 25, 2014
f2de8fc
Allow passing extra search directories to the tool installation
dstufft Dec 25, 2014
d35c1d4
Move the select_builder command to virtualenv.core
dstufft Dec 25, 2014
e590bb7
Make the builders responsible for checking their own availability
dstufft Dec 25, 2014
2179ebd
Move the wheels into virtualenv/_wheels instead
dstufft Dec 25, 2014
579119f
Move the script template to the module level
dstufft Dec 25, 2014
4d70ceb
Install our activate scripts into the virtual environments
dstufft Dec 25, 2014
513b2ca
switch the default prompt to "" from None
dstufft Dec 25, 2014
5b1fcf0
Start working on the isolation side of the LegacyBuilder
dstufft Dec 25, 2014
e2c9180
Rework the LegacyBuilder so it doesn't rely on sitecustomize
dstufft Dec 29, 2014
15b20bc
Enable the --system-site-packages flag in the LegacyBuilder
dstufft Dec 29, 2014
77da573
Remove the support for doing anything other than copying
dstufft Dec 29, 2014
ebe67b2
Handle clearing of an existing virtual environment ourselves
dstufft Dec 29, 2014
3985c6a
Use io.open so it works on Python 2 too.
ionelmc Dec 29, 2014
607355f
Move platform specifics into a "system" package. The builder now take…
ionelmc Dec 29, 2014
e02a8b5
Rename to flavours.
ionelmc Dec 29, 2014
2b3ebdd
Use objects so we can have properties or other nice stuff.
ionelmc Dec 29, 2014
ea50e17
Extend flavours and use them in the builders.
ionelmc Dec 29, 2014
966efe9
Escape the paths from the generated site.py (note that there's still …
ionelmc Dec 29, 2014
cb87335
Use the correct "lib" path on windows.
ionelmc Dec 29, 2014
da19f5a
Move the list of copied modules into the flavours.
ionelmc Dec 29, 2014
14486f4
Have name and destination as instance attributes. Make the destinatio…
ionelmc Dec 29, 2014
5c345c6
Refactor some of the subprocess stuff (maybe naming is not best). On …
ionelmc Dec 29, 2014
004f6f3
Fix the setup script to work with the new package layout.
ionelmc Dec 29, 2014
a5f6101
Disable this test (need to test new internals).
ionelmc Dec 29, 2014
04f087f
Remove bogus tox.ini
ionelmc Dec 29, 2014
d949658
Add initial test skel and tox configuration.
ionelmc Dec 29, 2014
c5098b8
Further fixes to get the integration test to run.
ionelmc Dec 29, 2014
8669117
Revert "Have name and destination as instance attributes. Make the de…
dstufft Jan 4, 2015
267b93e
This API should be symlinks not symlink
dstufft Jan 4, 2015
b66f2a8
Fix PEP8 and unused imports
dstufft Jan 4, 2015
d675384
Use Americanized spelling of Flavor
dstufft Jan 4, 2015
e873e96
Refactor flavors to not be singletons and slight refactor of selection
dstufft Jan 4, 2015
91808ea
Remove the leftover bits from virtualenv legacy
dstufft Jan 4, 2015
bc2166b
Small whitespace fix
dstufft Jan 4, 2015
83f39ee
classmethods should use cls not self
dstufft Jan 4, 2015
c79c932
Use an improved tox.ini pulled from the packaging lib
dstufft Jan 4, 2015
40ca93c
Rework the packaging to be more modern and easier to read
dstufft Jan 4, 2015
9e99110
Clear out the existing tests, they are not particularly great
dstufft Jan 4, 2015
4506b98
Fix up ignores and add a coveragerc
dstufft Jan 4, 2015
17a5c82
Refactor Posix behavior out of BaseFlavor into PosixFlavor
dstufft Jan 4, 2015
598494b
Test the virtualenv.flavors support
dstufft Jan 4, 2015
38749a0
Add virtualenv.create function to enable easy virtualenv creation
dstufft Jan 4, 2015
f8a7bd8
Add from __future__ imports to all files
dstufft Jan 4, 2015
93e5564
Fix Python 2.6 compatability
dstufft Jan 4, 2015
76d40a9
Fixup the documentation building
dstufft Jan 4, 2015
562a332
A few style fixes to make flake8 happy
dstufft Jan 4, 2015
f729a77
Test the virtualenv._utils module
dstufft Jan 4, 2015
a3b3d9c
Compatability only code doesn't need covered
dstufft Jan 4, 2015
464187b
Move the CLI integration into it's own module
dstufft Jan 4, 2015
2d60935
Test the core API
dstufft Jan 4, 2015
937ee6c
Move the unit tests down one level into a tests/unit directory
dstufft Jan 4, 2015
112a954
Differentiate between unit and functional tests
dstufft Jan 4, 2015
e019e1e
Test the BaseBuilder
dstufft Jan 5, 2015
7d82493
Test multiple extra search dirs as well
dstufft Jan 5, 2015
82d4bdb
Backport subprocess.check_output to Pytohn 2.6
dstufft Jan 5, 2015
c6f16d7
Add the missing environments
dstufft Jan 5, 2015
05c93c7
Fix up the packaging to include everything
dstufft Jan 5, 2015
00a0062
Test the VenvBuilder
dstufft Jan 5, 2015
6421ffe
We don't need sudo so set sudo: false to get Docker build env
dstufft Jan 5, 2015
0a50327
Fix legacy builder on OS X
dstufft Jan 5, 2015
502c765
Add appveyor control files
dstufft Jan 5, 2015
ed9495f
Remove some left over turds from pip's appveyor
dstufft Jan 5, 2015
ff148bf
Use posixpath explicitly
dstufft Jan 5, 2015
7894ab4
Expand the Windows test matrix to all supported Pythons on 32 and 64
dstufft Jan 5, 2015
9e39647
Appveyor doesn't appear to support 2.6 or 3.2
dstufft Jan 5, 2015
8a3c704
Drop the currently ignored --relocatable option
dstufft Jan 5, 2015
b17847e
Allow testing on the rewrite branch
dstufft Jan 5, 2015
3ec6a02
Merge pull request #698 from dstufft/remove-relocatable
dstufft Jan 5, 2015
00518c9
Run the appveyor tox envs with the correct arch (32 vs 64).
ionelmc Jan 6, 2015
de5db5a
Merge pull request #701 from dstufft/fix-windows-tests
dstufft Jan 6, 2015
76c6e30
Fix tox.ini so it runs the correct Python
dstufft Jan 6, 2015
5331b6b
Merge pull request #704 from dstufft/fix-tox-ini
dstufft Jan 6, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .appveyor/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Sample script to install Python and pip under Windows
# Authors: Olivier Grisel and Kyle Kastner
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/

$BASE_URL = "https://www.python.org/ftp/python/"
$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
$GET_PIP_PATH = "C:\get-pip.py"


function DownloadPython ($python_version, $platform_suffix) {
$webclient = New-Object System.Net.WebClient
$filename = "python-" + $python_version + $platform_suffix + ".msi"
$url = $BASE_URL + $python_version + "/" + $filename

$basedir = $pwd.Path + "\"
$filepath = $basedir + $filename
if (Test-Path $filename) {
Write-Host "Reusing" $filepath
return $filepath
}

# Download and retry up to 5 times in case of network transient errors.
Write-Host "Downloading" $filename "from" $url
$retry_attempts = 3
for($i=0; $i -lt $retry_attempts; $i++){
try {
$webclient.DownloadFile($url, $filepath)
break
}
Catch [Exception]{
Start-Sleep 1
}
}
Write-Host "File saved at" $filepath
return $filepath
}


function InstallPython ($python_version, $architecture, $python_home) {
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
if (Test-Path $python_home) {
Write-Host $python_home "already exists, skipping."
return $false
}
if ($architecture -eq "32") {
$platform_suffix = ""
} else {
$platform_suffix = ".amd64"
}
$filepath = DownloadPython $python_version $platform_suffix
Write-Host "Installing" $filepath "to" $python_home
$args = "/qn /i $filepath TARGETDIR=$python_home"
Write-Host "msiexec.exe" $args
Start-Process -FilePath "msiexec.exe" -ArgumentList $args -Wait -Passthru
Write-Host "Python $python_version ($architecture) installation complete"
return $true
}


function InstallPip ($python_home) {
$pip_path = $python_home + "/Scripts/pip.exe"
$python_path = $python_home + "/python.exe"
if (-not(Test-Path $pip_path)) {
Write-Host "Installing pip..."
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
Write-Host "Executing:" $python_path $GET_PIP_PATH
Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
} else {
Write-Host "pip already installed."
}
}

function InstallPackage ($python_home, $pkg) {
$pip_path = $python_home + "/Scripts/pip.exe"
& $pip_path install $pkg
}

function main () {
# InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
InstallPip $env:PYTHON
InstallPackage $env:PYTHON wheel
InstallPackage $env:PYTHON tox
}

main
47 changes: 47 additions & 0 deletions .appveyor/run_with_env.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
:: To build extensions for 64 bit Python 3, we need to configure environment
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1)
::
:: To build extensions for 64 bit Python 2, we need to configure environment
:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)
::
:: 32 bit builds do not require specific environment configurations.
::
:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
:: cmd interpreter, at least for (SDK v7.0)
::
:: More details at:
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
:: http://stackoverflow.com/a/13751649/163740
::
:: Author: Olivier Grisel
:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
@ECHO OFF

SET COMMAND_TO_RUN=%*
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows

SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%"
IF %MAJOR_PYTHON_VERSION% == "2" (
SET WINDOWS_SDK_VERSION="v7.0"
) ELSE IF %MAJOR_PYTHON_VERSION% == "3" (
SET WINDOWS_SDK_VERSION="v7.1"
) ELSE (
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
EXIT 1
)

IF "%PYTHON_ARCH%"=="64" (
ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
SET DISTUTILS_USE_SDK=1
SET MSSdk=1
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
) ELSE (
ECHO Using default MSVC build environment for 32 bit architecture
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
)
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
branch = True
source = virtualenv
23 changes: 13 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
virtualenv.egg-info
build
dist
docs/_build
.DS_Store
*.pyc
mock-*.egg
nose-*.egg
.tox
tests/test_activate_actual.output
*.egg-info/
*.egg
*.py[co]

.tox/
.cache/
.coverage

__pycache__/
_build/
build/
dist/
htmlcov/
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
language: python

sudo: false

env:
- TOXENV=py26
- TOXENV=py27
Expand All @@ -9,6 +11,9 @@ env:
- TOXENV=pypy
- TOXENV=pypy3
- TOXENV=docs
- TOXENV=pep8
- TOXENV=py2pep8
- TOXENV=packaging

install: pip install tox

Expand All @@ -18,7 +23,7 @@ branches:
only:
- master
- develop
- 1.11.X
- rewrite

notifications:
irc:
Expand Down
20 changes: 11 additions & 9 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
recursive-include bin *
recursive-include docs *
recursive-include scripts *
recursive-include virtualenv_support *.whl
recursive-include virtualenv_embedded *
recursive-exclude docs/_templates *
recursive-exclude docs/_build *
include virtualenv_support/__init__.py
include *.py
include AUTHORS.txt
include CONTRIBUTING.rst
include LICENSE.txt

include .coveragerc
include tox.ini

exclude .travis.yml
exclude appveyor.yml
prune .appveyor

recursive-include docs Makefile make.bat *.py *.rst *.empty
recursive-include tests *.py
55 changes: 55 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
environment:

global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\.appveyor\\run_with_env.cmd"

matrix:
- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.9"
PYTHON_ARCH: "32"
TOXENV: "py27"
TOXPYTHON: "C:\\Python27\\python.exe"

- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.9"
PYTHON_ARCH: "64"
TOXENV: "py27"
TOXPYTHON: "C:\\Python27-x64\\python.exe"

- PYTHON: "C:\\Python33"
PYTHON_VERSION: "3.3.6"
PYTHON_ARCH: "32"
TOXENV: "py33"
TOXPYTHON: "C:\\Python33\\python.exe"

- PYTHON: "C:\\Python33-x64"
PYTHON_VERSION: "3.3.6"
PYTHON_ARCH: "64"
TOXENV: "py33"
TOXPYTHON: "C:\\Python33-x64\\python.exe"

- PYTHON: "C:\\Python34"
PYTHON_VERSION: "3.4.2"
PYTHON_ARCH: "32"
TOXENV: "py34"
TOXPYTHON: "C:\\Python34\\python.exe"

- PYTHON: "C:\\Python34-x64"
PYTHON_VERSION: "3.4.2"
PYTHON_ARCH: "64"
TOXENV: "py34"
TOXPYTHON: "C:\\Python34-x64\\python.exe"

init:
- "ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%"

install:
- "powershell .appveyor\\install.ps1"

build: off

test_script:
- "%CMD_IN_ENV% %PYTHON%/Scripts/tox.exe"
71 changes: 0 additions & 71 deletions bin/rebuild-script.py

This file was deleted.

File renamed without changes.
Loading