Commits

t2y  committed 41d5e43 Merge

merged from original

  • Participants
  • Parent commits 142bddb, 760eb5f

Comments (0)

Files changed (11)

 dc74f106d8d2dd58031b2dbac31b1e068f780de4 2.5.3
 b0f27c65fa64627599c2a022a076ae5ee7157ae4 2.6
 445a58d5a05a1426cefb47e54b692b6a58fdcc4f 2.6.1
+625d85d3136ff746accc490c5f9210b1b0074533 2.6.2
+e7582879df06689ec54cd820c377e89114b75ee2 2.6.3
+2011-02-26  Doug Hellmann  <dhellmann@racemi.com>
+
+	* docs/sphinx/conf.py: Just hard-code the version.
+
+	* setup.py: Just hard-code the version.
+
+	* virtualenvwrapper/version.py: Put the version info inside the
+	package so it is available to the doc build and packaging
+	script. This also makes the readthedocs.org build work properly.
+
+	* setup.py: Import the version information from the package.
+
+	* docs/sphinx/conf.py: Import the version information from the
+	package.
+
+	* Makefile: Remove rule to get the version from the installer for
+	the doc build.
+
+2011-01-24  Doug Hellmann  <dhellmann@racemi.com>
+
+	* virtualenvwrapper.sh: Replace hard-coded name "virtualenv" with
+	the variable VIRTUALENVWRAPPER_VIRTUALENV to allow tests (and
+	users) to override it.
+
+	* tests/test_mkvirtualenv.sh (test_virtualenv_fails): Add a test
+	to reproduce the conditions reported in issue #76.
+
 2010-12-27  Doug Hellmann  <dhellmann@racemi.com>
 
 	* virtualenvwrapper.sh (virtualenvwrapper_get_python_version):
-# Get the version of the app.  This is used in the doc build.
-export VERSION=$(shell python setup.py --version)
-
 # Default target is to show help
 help:
 	@echo "sdist          - Source distribution"
 	@echo "html           - HTML documentation"
 	@echo "docclean       - Remove documentation build files"
-	@echo "register       - register a new release on PyPI"
-	@echo "website        - build web version of docs"
-	@echo "installwebsite - deploy web version of docs"
+	@echo "upload         - upload a new release to PyPI"
 	@echo "develop        - install development version"
 	@echo "test           - run the test suite"
 	@echo "test-quick     - run the test suite for bash and one version of Python ($(PYTHON26))"
-
+	@echo "website        - generate web version of the docs"
+	@echo "installwebsite - copy web version of HTML docs up to server"
 
 .PHONY: sdist
 sdist: html
 website: 
 	[ ~/Devel/doughellmann/doughellmann/templates/base.html -nt docs/sphinx/web/templates/base.html ] && (echo "Updating base.html" ; cp ~/Devel/doughellmann/doughellmann/templates/base.html docs/sphinx/web/templates/base.html) || exit 0
 	rm -rf docs/website
-	(cd docs && $(MAKE) html BUILDING_WEB=1 BUILDDIR="website/en" LANGUAGE="en")
-	(cd docs && $(MAKE) html BUILDING_WEB=1 BUILDDIR="website/es" LANGUAGE="es")
-	(cd docs && $(MAKE) html BUILDING_WEB=1 BUILDDIR="website/ja" LANGUAGE="ja")
+	(cd docs && $(MAKE) html BUILDDIR="website/en" LANGUAGE="en")
+	(cd docs && $(MAKE) html BUILDDIR="website/es" LANGUAGE="es")
+	(cd docs && $(MAKE) html BUILDDIR="website/ja" LANGUAGE="ja")
 
 installwebsite: website
 	(cd docs/website/en && rsync --rsh=ssh --archive --delete --verbose . www.doughellmann.com:/var/www/doughellmann/DocumentRoot/docs/virtualenvwrapper/)
 # Register the new version on pypi
 .PHONY: register
 register:
+	echo "USE upload target"
+	exit 1
 	python setup.py register
 
+.PHONY: upload
+upload:
+	python setup.py sdist upload
+
 # Testing
 test:
 	tox

File docs/en/history.rst

 Release History
 ===============
 
-Dev
+2.6.3
 
+  - Hard-code the version information in the setup.py and conf.py
+    scripts so it works for http://readthedocs.org.
+
+2.6.2
+
+  - Attempted to make the doc build work with http://readthedocs.org.
   - Merged in `Japanese translation of the documentation
     <http://www.doughellmann.com/docs/virtualenvwrapper/ja/>`__ from
     Tetsuya Morimoto.
+  - Incorporate a suggestion from Ales Zoulek to let the user specify
+    the virtualenv binary through an environment variable
+    (``VIRTUALENVWRAPPER_VIRTUALENV``).
 
 2.6.1
 

File docs/sphinx/conf.py

 bitbucket_project_url = 'http://bitbucket.org/dhellmann/virtualenvwrapper/'
 
 # Add any paths that contain templates here, relative to this directory.
-if building_web:
-    templates_path = ['web/templates']
-else:
-    templates_path = ['pkg/templates']
+#templates_path = ['pkg/templates']
 
 # The suffix of source filenames.
 source_suffix = '.rst'
 
 # General information about the project.
 project = u'virtualenvwrapper'
-copyright = u'2009, Doug Hellmann'
+copyright = u'2009-2011, Doug Hellmann'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
 # The short X.Y version.
-version = os.environ['VERSION']
+version = '2.6.3'
 # The full version, including alpha/beta/rc tags.
 release = version
 
 
 # The theme to use for HTML and HTML Help pages.  Major themes that come with
 # Sphinx are currently 'default' and 'sphinxdoc'.
-if building_web:
-    html_theme = 'default'
-else:
-    html_theme = 'sphinxdoc'
+html_theme = 'nature'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the

File docs/sphinx/web/templates/base.html

-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <title>{% block title %}Doug Hellmann{% endblock %}</title>
-{% block head_before_css %}
-{% endblock %}
-<link href="/static/css/leaves.css" rel="stylesheet" type="text/css" />
-{% block head_after_css %}
-{% endblock %}
-{% block head %}
-{% endblock %}
-<meta name="verify-v1" content="5saTcOa2HLac4V85yUg3SARfun1PqT5Upu7IR/6fpv4="/>
-</head>
-<body>
-    
-<div id="container">
-    
-<div id="header">
-  <h1>{% block page_heading %}Doug Hellmann{% endblock %}</h1>
-  <p>{% block page_subheading %}{% endblock %}</p>
-  <a id="admin-link" href="/admin/">admin</a>
-</div>
-
-<div id="sidebar_left_wrapper">
-
-<div id="navigation"> 
-	<ul id="navlist">
-		<li><a href="/">Home</a></li>
-		<li><a href="/PyMOTW/">PyMOTW</a></li>
-		<li><a href="http://blog.doughellmann.com/" target="_">Blog</a></li>
-		<li><a href="/articles/">Articles</a></li>
-		<li><a href="/projects/">Projects</a></li>
-		<li><a href="http://code.doughellmann.com/" target="_">Code</a></li>
-		<li><a href="/about/">About</a></li>
-	</ul>
-</div>
-
-{% block sidebar_l %}
-{% endblock %}
-</div>
-
-<div id="sidebar">
-{% block sidebar %}
-
-    <h2>Sidebar</h2>
-    <p>You have reached the sidebar, put news, links, or anything textual in here. I think I'll drag on with typing nonsense text, until you feel really really sleepy. Of course, you wouldn't waste time reading this. Some Latin would be more useful.</p>
-{% endblock %}
-    
-    <p class="ads">
-    <script type="text/javascript"><!--
-    google_ad_client = "pub-3205160560229413";
-    google_ad_width = 120;
-    google_ad_height = 600;
-    google_ad_format = "120x600_as";
-    google_ad_type = "text";
-    //2007-10-27: www.doughellmann.com
-    google_ad_channel = "0828653884";
-    google_color_border = "FFFFFF";
-    google_color_bg = "FFFFFF";
-    google_color_link = "CC6714";
-    google_color_text = "000000";
-    google_color_url = "999999";
-    google_ui_features = "rc:0";
-    //-->
-    </script>
-    <script type="text/javascript"
-      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
-    </script>
-    </p>
-
-</div>
-	  
-<div id="content">
-{% block content %}
-{% block relbar1 %}{% endblock %}
-
-  <h2>Welcome to Leaves.</h2>
-  <p>Welcome to Leaves, a static, 3 column layout made with your usual CSS and XHTML. It is able to correctly accommodate any font size increases or shrinkages (Is that a word?). It seems to work fine in Firefox, Opera, Internet Explorer and Safari. It's more minimal than other designs, because I think images (drop shadows, giant header images) are being obsessively over used these days. I think it detracts from the content and shoves way too much information to a viewer all at the same time, so here you go: Leaves, a minimalist design. Feel free to massacre or change the design to your liking. Well, I guess it's time for some more Latin. <strong>If you want me to create a custom design for you, feel free to drop me a line anytime at web@smallpark.org </strong></p>
-
-{% block relbar2 %}{% endblock %}
-{% endblock %}
-
-{% block addthis %}
-<div id="addthis"><a href="http://www.addthis.com/bookmark.php" onclick="addthis_url   = location.href; addthis_title = document.title; return addthis_click(this);" target="_blank"><img src="http://s7.addthis.com/static/btn/lg-share-en.gif" width="125" height="16" border="0" alt="Bookmark and Share" /></a><script type="text/javascript">var addthis_pub = "dhellmann";</script><script type="text/javascript" src="http://s7.addthis.com/js/widget.php?v=10"></script></div>
-{% endblock %}
-
-{% block comments %}
-<!-- Disqus -->
-<div id="disqus_wrapper">
-<div id="disqus_thread"></div><script type="text/javascript" src="http://disqus.com/forums/doughellmann/embed.js"></script><noscript><a href="http://doughellmann.disqus.com/?url=ref">View the discussion thread.</a></noscript><a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
-</div>
-{% endblock %}
-</div>
-
-<div id="footer_ads">
-
-    <p><script type="text/javascript"><!--
-    google_ad_client = "pub-3205160560229413";
-    google_ad_width = 728;
-    google_ad_height = 90;
-    google_ad_format = "728x90_as";
-    google_ad_type = "text";
-    //2007-10-21: www.doughellmann.com
-    google_ad_channel = "0828653884";
-    google_color_border = "FFFFFF";
-    google_color_bg = "FFFFFF";
-    google_color_link = "CC6714";
-    google_color_text = "000000";
-    google_color_url = "999999";
-    google_ui_features = "rc:0";
-    //-->
-    </script>
-    <script type="text/javascript"
-      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
-    </script></p>
-</div>
-
-<div id="footer">
- {% block footer %}
-    
-<p>Copyright Doug Hellmann | Design based on "Leaves" by <a href="http://smallpark.org">SmallPark</a></p>
-   
-    <script src="http://www.google-analytics.com/urchin.js"
-    type="text/javascript">
-    </script>
-    <script type="text/javascript">
-      _uacct = "UA-1847381-1";
-      urchinTracker();
-    </script>
-
- {% endblock %}
-</div>
-
-</div>
-
-<!-- Disqus -->
-<script type="text/javascript">
-//<![CDATA[
-(function() {
-		var links = document.getElementsByTagName('a');
-		var query = '?';
-		for(var i = 0; i < links.length; i++) {
-			if(links[i].href.indexOf('#disqus_thread') >= 0) {
-				query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
-			}
-		}
-		document.write('<script type="text/javascript" src="http://disqus.com/forums/doughellmann/get_num_replies.js' + query + '"></' + 'script>');
-	})();
-//]]>
-</script>
-
-
-</body>
-</html>

File docs/sphinx/web/templates/layout.html

-{% extends "base.html" %}
-
-{% block title %}{{ title }} - {{ project }}{% endblock %}
-
-{% block head_before_css %}
-<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" 
-    type="text/css" />
-<style>
-    body {
-        margin: 8px;
-    }
-    .highlight {
-        background-color: white;
-        border: 0;
-    }
-    .highlight pre {
-        background-color: white;
-    }
-</style>
-{% endblock %}
-
-{% block head %}
-<script type="text/javascript">
-  var DOCUMENTATION_OPTIONS = {
-      URL_ROOT:    '{{ pathto("", 1) }}',
-      VERSION:     '{{ release }}',
-      COLLAPSE_MODINDEX: false,
-      FILE_SUFFIX: '{{ file_suffix }}'
-  };
-</script>
-
-<script type="text/javascript" src="{{ pathto('_static/jquery.js', 1) }}"></script>
-<script type="text/javascript" src="{{ pathto('_static/doctools.js', 1) }}"></script>
-
-{%- block rellinks %}
-    {%- if hasdoc('about') %}
-    <link rel="author" title="About these documents" href="{{ pathto('about') }}" />
-    {%- endif %}
-    <link rel="contents" title="Global table of contents" href="{{ pathto('contents') }}" />
-    <link rel="index" title="Global index" href="{{ pathto('genindex') }}" />
-    {%- if hasdoc('copyright') %}
-    <link rel="copyright" title="Copyright" href="{{ pathto('copyright') }}" />
-    {%- endif %}
-    <link rel="top" title="{{ docstitle }}" href="{{ pathto('index') }}" />
-    {%- if parents %}
-    <link rel="up" title="{{ parents[-1].title|striptags }}" href="{{ parents[-1].link|e }}" />
-    {%- endif %}
-    {%- if next %}
-    <link rel="next" title="{{ next.title|striptags }}" href="{{ next.link|e }}" />
-    {%- endif %}
-    {%- if prev %}
-    <link rel="prev" title="{{ prev.title|striptags }}" href="{{ prev.link|e }}" />
-    {%- endif %}
-{%- endblock %}
-{% endblock %}
-    
-{% block sidebar %}
-{%- block sidebartoc %}
-{%- if display_toc %}
-  <h3>Page Contents</h3>
-  {{ toc }}
-{%- endif %}
-{%- endblock %}
-
-    <h3>Navigation</h3>
-    <a href="/docs/{{project}}/">Top</a><br/>
-{% if next or prev %}
-    {%- if prev %}
-      <a href="{{ prev.link|e }}" title="previous chapter">Previous: {{ prev.title }}</a><br/>
-    {%- endif %}
-
-    {%- if next %}
-      <a href="{{ next.link|e }}" title="next chapter">Next: {{ next.title }}</a><br/>
-    {%- endif %}
-{% endif %}
-    <a href="/projects/{{project}}/">{{project}} Home</a><br/>
-
-    {%- if show_source and has_source and sourcename %}
-      <h3>{{ _('This Page') }}</h3>
-      <a href="{{ pathto('_sources/' + sourcename, true)|e }}"
-               rel="nofollow">{{ _('Show Source') }}</a>
-      </ul>
-    {%- endif %}
-
-    <p>
-  <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/" rel="license"><img alt="Creative Commons License" style="border-width:0; align: center;" src="http://i.creativecommons.org/l/by-nc-sa/3.0/us/88x31.png"/></a>
-    </p>
-{% endblock %}
-
-{% block sidebar_l %}
-{% endblock %}
-
-{% block content %}
-{% block body %}{% endblock %}
-{% endblock %}
-
-{% block footer %}
-<p>
-  {%- if hasdoc('copyright') %}
-    <a href="{{ pathto('copyright') }}">&copy; Copyright </a> {{ copyright }}.
-  {%- else %}
-    &copy; Copyright {{ copyright }}.
-  {%- endif %}
-  {%- if last_updated %}
-    | Last updated on {{ last_updated }}.
-  {%- endif %}
-  {%- if show_sphinx %}
-   | Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
-  {%- endif %}
-   | Design based on "Leaves" by <a href="http://smallpark.org">SmallPark</a>
-</p>
-   
-<script src="http://www.google-analytics.com/urchin.js" type="text/javascript" />
-<script type="text/javascript">
-  _uacct = "UA-1847381-1";
-  urchinTracker();
-</script>
-{% endblock %}
 #!/usr/bin/env python
 
 PROJECT = 'virtualenvwrapper'
-VERSION = '2.6.1'
+
+# Change docs/sphinx/conf.py too!
+VERSION = '2.6.3'
 
 # Bootstrap installation of Distribute
 import distribute_setup

File tests/test.sh

     assertSame "$expected" "$output"
 }
 
+test_virtualenvwrapper_space_in_workon_home() {
+    before="$WORKON_HOME"
+    export WORKON_HOME="$WORKON_HOME/this has spaces"
+ 	expected="$WORKON_HOME"
+    mkdir -p "$expected"
+    virtualenvwrapper_initialize
+    RC=$?
+    assertSame "$expected" "$WORKON_HOME"
+    assertSame "0" "$RC"
+    export WORKON_HOME="$before"
+}
+
 test_virtualenvwrapper_verify_workon_home() {
     assertTrue "WORKON_HOME not verified" virtualenvwrapper_verify_workon_home
 }
     mkvirtualenv --no-site-packages no_wrappers
     expected="ImportError: No module named virtualenvwrapper.hook_loader"
     output=$(VIRTUALENVWRAPPER_PYTHON=$(which python) $SHELL $return_to/virtualenvwrapper.sh 2>&1)
-    echo "$output" | grep "$expected" 2>&1
+    echo "$output" | grep -q "$expected" 2>&1
     found=$?
     assertTrue "Expected \"$expected\", got: \"$output\"" "[ $found -eq 0 ]"
     assertFalse "Failed to detect invalid Python location" "VIRTUALENVWRAPPER_PYTHON=$VIRTUAL_ENV/bin/python $SHELL $return_to/virtualenvwrapper.sh >/dev/null 2>&1"

File tests/test_mkvirtualenv.sh

     WORKON_HOME="$old_home"
 }
 
+test_virtualenv_fails () {
+    # Test to reproduce the conditions in issue #76
+    # https://bitbucket.org/dhellmann/virtualenvwrapper/issue/76/
+    # 
+    # Should not run the premkvirtualenv or postmkvirtualenv hooks
+    # because the environment is not created and even the
+    # premkvirtualenv hooks are run *after* the environment exists
+    # (but before it is activated).
+    export pre_test_dir=$(cd "$test_dir"; pwd)
+
+    VIRTUALENVWRAPPER_VIRTUALENV=false
+
+    echo "#!/bin/sh" > "$WORKON_HOME/premkvirtualenv"
+    echo "echo GLOBAL premkvirtualenv \`pwd\` \"\$@\" >> \"$pre_test_dir/catch_output\"" >> "$WORKON_HOME/premkvirtualenv"
+    chmod +x "$WORKON_HOME/premkvirtualenv"
+
+    echo "echo GLOBAL postmkvirtualenv >> $test_dir/catch_output" > "$WORKON_HOME/postmkvirtualenv"
+    mkvirtualenv "env3"
+    output=$(cat "$test_dir/catch_output" 2>/dev/null)
+    workon_home_as_pwd=$(cd $WORKON_HOME; pwd)
+    expected=""
+    assertSame "$expected" "$output"
+    rm -f "$WORKON_HOME/premkvirtualenv"
+    rm -f "$WORKON_HOME/postmkvirtualenv"
+
+    VIRTUALENVWRAPPER_VIRTUALENV=virtualenv
+}
+
 # test_mkvirtualenv_sitepackages () {
 #     # Without the option verify that site-packages are copied.
 #     mkvirtualenv "env3"

File virtualenvwrapper.sh

     VIRTUALENVWRAPPER_PYTHON="$(\which python)"
 fi
 
+# Set the name of the virtualenv app to use.
+if [ "$VIRTUALENVWRAPPER_VIRTUALENV" = "" ]
+then
+    VIRTUALENVWRAPPER_VIRTUALENV="virtualenv"
+fi
+
 virtualenvwrapper_derive_workon_home() {
     typeset workon_home_dir="$WORKON_HOME"
 
 
 # Verify that virtualenv is installed and visible
 virtualenvwrapper_verify_virtualenv () {
-    typeset venv=$(\which virtualenv | (unset GREP_OPTIONS; \grep -v "not found"))
+    typeset venv=$(\which "$VIRTUALENVWRAPPER_VIRTUALENV" | (unset GREP_OPTIONS; \grep -v "not found"))
     if [ "$venv" = "" ]
     then
-        echo "ERROR: virtualenvwrapper could not find virtualenv in your path" >&2
+        echo "ERROR: virtualenvwrapper could not find $VIRTUALENVWRAPPER_VIRTUALENV in your path" >&2
         return 1
     fi
     if [ ! -e "$venv" ]
     then
-        echo "ERROR: Found virtualenv in path as \"$venv\" but that does not exist" >&2
+        echo "ERROR: Found $VIRTUALENVWRAPPER_VIRTUALENV in path as \"$venv\" but that does not exist" >&2
         return 1
     fi
     return 0
     virtualenvwrapper_verify_workon_home || return 1
     virtualenvwrapper_verify_virtualenv || return 1
     (cd "$WORKON_HOME" &&
-        virtualenv "$@" &&
-        [ -d "$WORKON_HOME/$envname" ] && virtualenvwrapper_run_hook "pre_mkvirtualenv" "$envname"
+        "$VIRTUALENVWRAPPER_VIRTUALENV" "$@" &&
+        [ -d "$WORKON_HOME/$envname" ] && \
+            virtualenvwrapper_run_hook "pre_mkvirtualenv" "$envname"
         )
     typeset RC=$?
     [ $RC -ne 0 ] && return $RC
+
     # If they passed a help option or got an error from virtualenv,
     # the environment won't exist.  Use that to tell whether
     # we should switch to the environment and run the hook.