[pkg-boinc-commits] r379 - branches/experimental/boinc/debian/extra
Frank S. Thomas
fst-guest at costa.debian.org
Fri Mar 17 15:25:40 UTC 2006
Author: fst-guest
Date: 2006-03-17 15:25:40 +0000 (Fri, 17 Mar 2006)
New Revision: 379
Modified:
branches/experimental/boinc/debian/extra/boinc_applinks
Log:
Simplified the boinc_applinks code.
Modified: branches/experimental/boinc/debian/extra/boinc_applinks
===================================================================
--- branches/experimental/boinc/debian/extra/boinc_applinks 2006-03-14 12:42:57 UTC (rev 378)
+++ branches/experimental/boinc/debian/extra/boinc_applinks 2006-03-17 15:25:40 UTC (rev 379)
@@ -37,48 +37,36 @@
# Manage symbolic links and directories.
if opts.create == None:
return
-
for project in projects:
if opts.project == '' or project == opts.project:
for url in projects[project]['urls']:
project_dir = opts.data_dir + '/projects/' + url + '/'
- manage_dirs(project_dir, opts.create)
manage_symlink(projects[project]['app_info'],
project_dir + 'app_info.xml', opts.create)
for app_src in projects[project]['apps']:
app_dst = project_dir + os.path.basename(app_src)
manage_symlink(app_src, app_dst, opts.create)
-
- # Try to remove project directories again. os.removedirs will
- # fail silently in the previous invocation if the symlinks are
- # still present.
- if opts.create == False:
- manage_dirs(project_dir, False)
return
-def manage_dirs(path, bool):
+def manage_symlink(src, dst, bool):
+ dirname = os.path.dirname(dst)
+
try:
- if bool == False:
- os.removedirs(path)
+ if bool == True:
+ os.makedirs(dirname)
+ os.symlink(src, dst)
else:
- os.makedirs(path)
+ if os.path.isfile(dst) and not os.path.islink(dst):
+ return
+ elif os.path.islink(dst):
+ os.remove(dst)
+
+ os.removedirs(dirname)
except OSError:
pass
-
return
-def manage_symlink(src, dst, bool):
- if os.path.isfile(dst) and not os.path.islink(dst):
- return
- elif os.path.islink(dst):
- os.remove(dst)
-
- if bool == True:
- os.symlink(src, dst)
-
- return
-
def parse_options():
parser = optparse.OptionParser()
More information about the pkg-boinc-commits
mailing list