diff options
-rw-r--r-- | update_manual.py | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/update_manual.py b/update_manual.py index a9a56064..d6c069cd 100644 --- a/update_manual.py +++ b/update_manual.py @@ -24,6 +24,7 @@ from shutil import rmtree, move from zipfile import ZipFile from subprocess import call import fileinput +import time def fix_image_path(path_to_fix, images_path): @@ -37,7 +38,7 @@ def fix_image_path(path_to_fix, images_path): for line in f: line = line.rstrip('\n') line = line.replace('cco:/', images_path) - # with fileinput, you need to us 'print' and not 'write' to + # with fileinput, you need to use 'print' and not 'write' to # write in the file print(line) @@ -54,7 +55,9 @@ def fix_common_path(path_to_fix): line = line.rstrip('\n') line = line.replace('"../common/', '"../../common/') line = line.replace('(../common/', '(../../common/') - # with fileinput, you need to us 'print' and not 'write' to + line = line.replace('</a></div><div class="navfooter">', + '</a></div><div id="upload_date">Uploaded on ' + time.strftime("%d/%m/%Y", time.gmtime()) + '</div><div class="navfooter">') + # with fileinput, you need to use 'print' and not 'write' to # write in the file print(line) @@ -87,6 +90,7 @@ if __name__ == "__main__": manual_path = join(manual_name, release, language) if not isdir(manual_path): makedirs(manual_path) + print("Processing manual " + manual_path) # create path to common directories common_dir = join(manual_path, 'common') @@ -126,12 +130,24 @@ if __name__ == "__main__": fix_image_path(manual_path, image_path) # tell git about the changes - command_add = ['git', 'add'] + files_to_add - call(command_add) + if len(files_to_add) == 0: + print("Nothing to add to the git") + else: + command_add = ['git', 'add'] + files_to_add + call(command_add) - command_remove = ['git', 'rm'] + files_to_remove - call(command_remove) + if len(files_to_remove) == 0: + print("Nothing to remove from the git") + else: + command_remove = ['git', 'rm'] + files_to_remove + call(command_remove) # ask for git status (the user has to commit himself) command_status = ['git', 'status'] call(command_status) + + + + + + |