Skip to content

Commit

Permalink
Put the version in just one place (virtualenv.py)
Browse files Browse the repository at this point in the history
--HG--
branch : trunk
  • Loading branch information
ianb committed Nov 10, 2009
1 parent f688742 commit 9e8bfeb
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 6 deletions.
20 changes: 17 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,23 @@
# other places throughout the built documents.
#
# The short X.Y version.
version = '1.4'
# The full version, including alpha/beta/rc tags.
release = '1.4.1.post1'

## Figure out the version from virtualenv.py:
version_re = re.compile(
r'virtualenv_version = "(.*?)"')
fp = open(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
'virtualenv.py'))
version = None
for line in fp:
match = version_re.search(line)
if match:
release = match.group(1)
break
else:
raise Exception("Cannot find version in virtualenv.py")
fp.close()
del line, fp, version_re
version = '.'.join(release.split('.')[:2])

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand Down
32 changes: 30 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,41 @@
from distutils.core import setup
print 'Note: without Setuptools installed you will have to use "python -m virtualenv ENV"'
import sys, os
import re
## A warning just for Ian:
try:
import getpass
except ImportError:
is_ianb = False
else:
is_ianb = getpass.getuser() == 'ianb'

version = '1.4.1.post1'
here = os.path.dirname(os.path.abspath(__file__))

f = open(os.path.join(os.path.dirname(__file__), 'docs', 'index.txt'))
## Figure out the version from virtualenv.py:
version_re = re.compile(
r'virtualenv_version = "(.*?)"')
fp = open(os.path.join(here, 'virtualenv.py'))
version = None
for line in fp:
match = version_re.search(line)
if match:
version = match.group(1)
break
else:
raise Exception("Cannot find version in virtualenv.py")
fp.close()

## Get long_description from index.txt:
f = open(os.path.join(here, 'docs', 'index.txt'))
long_description = f.read().strip()
f.close()

if is_ianb and 'register' in sys.argv:
if 'hg tip\n~~~~~~' in long_description:
print >> sys.stderr, (
"WARNING: hg tip is in index.txt")

setup(name='virtualenv',
version=version,
description="Virtual Python Environment builder",
Expand Down
4 changes: 3 additions & 1 deletion virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"""Create a "virtual" Python installation
"""

virtualenv_version = "1.4.1.post1"

import sys
import os
import optparse
Expand Down Expand Up @@ -410,7 +412,7 @@ def filter_ez_setup(line, project_name='setuptools'):

def main():
parser = optparse.OptionParser(
version="1.4.1.post1",
version=virtualenv_version,
usage="%prog [OPTIONS] DEST_DIR")

parser.add_option(
Expand Down

0 comments on commit 9e8bfeb

Please sign in to comment.