fix dohtml's recursive behaviour, now it correctly includes files under subdirectories

This commit is contained in:
Gökçen Eraslan
2008-01-28 12:28:44 +00:00
parent f85a95181a
commit 4cc587f638
+7 -5
View File
@@ -25,7 +25,7 @@ _ = __trans.ugettext
# Pisi Modules # Pisi Modules
import pisi.context as ctx import pisi.context as ctx
from pisi.util import join_path from pisi.util import join_path, remove_prefix
# ActionsAPI Modules # ActionsAPI Modules
import pisi.actionsapi import pisi.actionsapi
@@ -71,11 +71,13 @@ def dohtml(*sourceFiles):
if os.path.isfile(source) and os.path.splitext(source)[1] in allowed_extensions: if os.path.isfile(source) and os.path.splitext(source)[1] in allowed_extensions:
system('install -m0644 "%s" %s' % (source, destionationDirectory)) system('install -m0644 "%s" %s' % (source, destionationDirectory))
if os.path.isdir(source) and os.path.basename(source) not in disallowed_directories: if os.path.isdir(source) and os.path.basename(source) not in disallowed_directories:
eraser = os.path.split(source)[0]
for root, dirs, files in os.walk(source): for root, dirs, files in os.walk(source):
for source in files: newRoot = remove_prefix(eraser, root)
if os.path.splitext(source)[1] in allowed_extensions: for sourcename in files:
makedirs(destionationDirectory) if os.path.splitext(sourcename)[1] in allowed_extensions:
system('install -m0644 %s %s' % (join_path(root, source), destionationDirectory)) makedirs(join_path(destionationDirectory, newRoot))
system('install -m0644 %s %s' % (join_path(root, sourcename), join_path(destionationDirectory, newRoot, sourcename)))
def doinfo(*sourceFiles): def doinfo(*sourceFiles):
'''inserts the into files in the list of files into /usr/share/info''' '''inserts the into files in the list of files into /usr/share/info'''