diff options
author | filip <filip.komar@gmail.com> | 2015-07-01 21:09:26 +0200 |
---|---|---|
committer | filip <filip.komar@gmail.com> | 2015-07-01 21:09:26 +0200 |
commit | ccf9af22ef102ad2fc2708f43158e883a6a4de52 (patch) | |
tree | 47aaa4ad8928760bb4146e620fc69bf8c9bf545f /update_manual.py | |
parent | b9823d00c9c83cfc704f6bebb6757b7c506cd2de (diff) | |
download | doc-ccf9af22ef102ad2fc2708f43158e883a6a4de52.tar doc-ccf9af22ef102ad2fc2708f43158e883a6a4de52.tar.gz doc-ccf9af22ef102ad2fc2708f43158e883a6a4de52.tar.bz2 doc-ccf9af22ef102ad2fc2708f43158e883a6a4de52.tar.xz doc-ccf9af22ef102ad2fc2708f43158e883a6a4de52.zip |
Adding an upload date to the update_manual.py + small improvements
* don't run git if there is no need
Diffstat (limited to 'update_manual.py')
-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) + + + + + + |