Skip to content

Commit

Permalink
add the refresh command
Browse files Browse the repository at this point in the history
  • Loading branch information
nferrier committed Dec 1, 2010
1 parent 8af0323 commit 2ade667
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
8 changes: 8 additions & 0 deletions README.creole
Expand Up @@ -67,6 +67,14 @@ Rebuilding also clears but immediately rebuilds:
veh [-R repositorydir] rebuild
}}}

Refresh just tries to re-get each package, without the initial trashing of the virtualenv:

{{{
veh [-R repositorydir] refresh
}}}

This is useful for adding packages.

You can also list the packages that are declred in the config file:

{{{
Expand Down
15 changes: 12 additions & 3 deletions src/veh
Expand Up @@ -28,7 +28,7 @@ def make_venv(repo):
from os.path import expanduser
# TODO read a user or site wide config file for whether to use virtualenvwrapper
# could have a "make virtualenv config with a possible 'internal' value"
_popencmd(["virtualenv", "%s/.venv" % repo])
_popencmd(["virtualenv", "--no-site-packages", "%s/.venv" % repo])
with open("%s/.venv/.startup_rc" % repo, "w") as out:
print >>out, "source %s\nsource %s\n" % (
expanduser("~/.bashrc"),
Expand All @@ -37,8 +37,12 @@ def make_venv(repo):


def fill_venv(repo):
"""Install packages into the venv"""
make_venv(repo)
"""Install packages into the venv.
Makes the venv if it needs to."""
if not pathexists("%s/.venv" % repo):
make_venv(repo)

cfgfile = "%s/.veh.conf" % repo
if not pathexists(cfgfile):
raise ConfigMissing(cfgfile)
Expand Down Expand Up @@ -227,6 +231,11 @@ class VehCmd(SysArgsCmd):
# Rebuild it.
venv(root)

def do_refresh(self, arg):
"""Refresh all packages"""
root = self._getroot()
fill_venv(root)

def do_shell(self, shellcmd):
"""Start a shell inside the venv'd repository possibly running shellcmd.
Expand Down

0 comments on commit 2ade667

Please sign in to comment.