Mercurial > treepkg > treepkg
comparison treepkg/publish.py @ 439:8e0c81870e5e treepkg-status
cleanup modules
fix test_info testcases
added testcases for remove_trailingslashes and expand_filename
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Fri, 06 Aug 2010 11:06:08 +0000 |
parents | 9cfa9f64387a |
children |
comparison
equal
deleted
inserted
replaced
438:3a3cad8f6f60 | 439:8e0c81870e5e |
---|---|
10 import os.path | 10 import os.path |
11 | 11 |
12 import util | 12 import util |
13 from treepkg.run import call, capture_output | 13 from treepkg.run import call, capture_output |
14 from treepkg.cmdexpand import cmdexpand | 14 from treepkg.cmdexpand import cmdexpand |
15 | |
16 def remove_trailing_slashes(s): | |
17 return s.rstrip("/") | |
18 | |
19 def expand_filename(filename): | |
20 """ | |
21 Applies os.path.expanduser and os.path.expandvars to filename | |
22 """ | |
23 return os.path.expandvars(os.path.expanduser(filename)) | |
24 | 15 |
25 def prefix_for_remote_command(user, host): | 16 def prefix_for_remote_command(user, host): |
26 """Returns the ssh call needed to run a command on a remote host. | 17 """Returns the ssh call needed to run a command on a remote host. |
27 If host is empty, the function assumes the command is to be run on | 18 If host is empty, the function assumes the command is to be run on |
28 the local host as the same user that exectutes this function, so | 19 the local host as the same user that exectutes this function, so |
95 call(cmdexpand("rsync @rsync_flags -r --perms --times --omit-dir-times" | 86 call(cmdexpand("rsync @rsync_flags -r --perms --times --omit-dir-times" |
96 " $cachedir/ $remote_destdir/", | 87 " $cachedir/ $remote_destdir/", |
97 rsync_flags=rsync_flags, remote_destdir=remote_destdir, | 88 rsync_flags=rsync_flags, remote_destdir=remote_destdir, |
98 **variables)) | 89 **variables)) |
99 | 90 |
91 def get_binary_arch(arch): | |
92 if not arch is None and not arch.startswith("binary") and arch != "source": | |
93 arch = "binary-" + arch | |
94 return arch | |
100 | 95 |