Skip to content

Commit

Permalink
Updated docs a little and added Jason to the authors file.
Browse files Browse the repository at this point in the history
This also changes the docs slightly regarding the default execution policy setting on Windows 7 ("Restricted" according to http://technet.microsoft.com/en-us/library/dd347641.aspx).
  • Loading branch information
jezdez committed Dec 3, 2011
1 parent 1097153 commit 6b6aa4f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 48 deletions.
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Curt Micol
Douglas Creager
Ethan Jucovy
Gunnlaugur Thor Briem
Jason R. Coombs
Jeff Hammel
Jorge Vargas
Josh Bronson
Expand Down
101 changes: 53 additions & 48 deletions docs/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ and Powershell.

On Posix systems you can do::

$ source bin/activate
$ source bin/activate

This will change your ``$PATH`` to point to the virtualenv's ``bin/``
directory. (You have to use ``source`` because it changes your shell
Expand All @@ -255,7 +255,7 @@ value before running the ``activate`` script.

On Windows you just do::

> \path\to\env\Scripts\activate
> \path\to\env\Scripts\activate

And type `deactivate` to undo the changes.

Expand All @@ -264,6 +264,57 @@ either activate.bat or activate.ps1 (as appropriate) to activate the
virtual environment. If using Powershell, see the notes about code signing
below.

.. note::

If using Powershell, the ``activate`` script is subject to the
`execution policies`_ on the system. By default on Windows 7, the system's
excution policy is set to ``Restricted``, meaning no scripts like the
``activate`` script are allowed to be executed. But that can't stop us
from changing that slightly to allow it to be executed.

In order to use the script, you have to relax your system's execution
policy to ``AllSigned``, meaning all scripts on the system must be
digitally signed to be executed. Since the virtualenv activation
script is signed by one of the authors (Jannis Leidel) this level of
the execution policy suffices. As an adminstrator run::

PS C:\> Set-ExecutionPolicy AllSigned

Then you'll be asked to trust the signer, when executing the script.
You will be prompted with the following::

PS C:\> virtualenv .\foo
New python executable in C:\foo\Scripts\python.exe
Installing setuptools................done.
Installing pip...................done.
PS C:\> .\foo\scripts\activate

Do you want to run software from this untrusted publisher?
File C:\foo\scripts\activate.ps1 is published by E=jannis@leidel.info,
CN=Jannis Leidel, L=Berlin, S=Berlin, C=DE, Description=581796-Gh7xfJxkxQSIO4E0
and is not trusted on your system. Only run scripts from trusted publishers.
[V] Never run [D] Do not run [R] Run once [A] Always run [?] Help
(default is "D"):A
(foo) PS C:\>

If you select ``[A] Always Run``, the certificate will be added to the
Trusted Publishers of your user account, and will be trusted in this
user's context henceforth. If you select ``[R] Run Once``, the script will
be run, but you will be prometed on a subsequent invocation. Advanced users
can add the signer's certificate to the Trusted Publishers of the Computer
account to apply to all users (though this technique is out of scope of this
document).

Alternatively, you may relax the system execution policy to allow running
of local scripts without verifying the code signature using the following::

PS C:\> Set-ExecutionPolicy RemoteSigned

Since the ``activate.ps1`` script is generated locally for each virtualenv,
it is not considered a remote script and can then be executed.

.. _`execution policies`: http://technet.microsoft.com/en-us/library/dd347641.aspx

The ``--system-site-packages`` Option
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -377,52 +428,6 @@ setuptools/distribute or pip. Instead, it will exit with status code 1
if it fails to find local distributions for any of these required
packages.


Powershell Activation Script Notes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note, if using Powershell, the ``activate`` script is subject to the
execution policies on the system. By default on Windows 7, the system's
excution policy is set to `AllSigned`, meaning all scripts on the system
must be digitally signed to be executed.

The virtualenv activation script is signed by one of the
contributors. In order to use the script, you may elect to trust the
signer script or relax your system's execution policy.

To trust the signer, simply execute the script. You will be prompted with
the following::

PS C:> virtualenv \foo
New python executable in \foo\Scripts\python.exe
Installing setuptools................done.
Installing pip...................done.
PS C:> \foo\scripts\activate

Do you want to run software from this untrusted publisher?
File \foo\scripts\activate.ps1 is published by E=jannis@leidel.info, CN=Jannis Leidel, L=Berlin, S=Berlin, C=DE, Description=581796-Gh7xfJxkxQSIO4E0
and is not trusted on your system. Only run scripts from trusted publishers.
[V] Never run [D] Do not run [R] Run once [A] Always run [?] Help
(default is "D"):A
(foo) PS C:>

If you select `Always Run`, the certificate will be added to the
Trusted Publishers of your user account, and will be trusted in this
user's context henceforth. If you select `Run Once`, the script will be
run, but you will be prometed on a subsequent invocation. Advanced users
can add the signer's
certificate to the Trusted Publishers of the Computer account to apply to
all users (though this technique is out of scope of this document).

Alternatively, you may relax the system execution policy to allow running
of local scripts without verifying the code signature using the following::

PS> Set-ExecutionPolicy RemoteSigned

Since the activate.ps1 script is generated locally, it is not considered
a remote script and can then be executed.


Compare & Contrast with Alternatives
------------------------------------

Expand Down
6 changes: 6 additions & 0 deletions docs/news.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changes & News
--------------

In development
~~~~~~~~~~~~~~

* Added activation script for Powershell (signed by Jannis Leidel). Many
thanks to Jason R. Coombs.

1.7 (2011-11-30)
~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit 6b6aa4f

Please sign in to comment.