[Pcsclite-git-commit] [website] 07/07: create_driver_version.py: add a cache mechanism

Ludovic Rousseau rousseau at moszumanska.debian.org
Thu Oct 22 16:45:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository website.

commit 24ece9e5a6ee9545454813b4329980bdf887d464
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Thu Oct 22 18:44:28 2015 +0200

    create_driver_version.py: add a cache mechanism
    
    The results of git are now stored in the .cache/ directory.
    Any new execution is now mostly immediate.
---
 .gitignore               |  1 +
 create_driver_version.py | 12 ++++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0901516..943219c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ select_readers/js/bootstrap.min.js
 select_readers/js/jquery-1.11.3.min.js
 select_readers/js/url.js
 select_readers/js/readers.js
+.cache
diff --git a/create_driver_version.py b/create_driver_version.py
index bccff7c..8169bbf 100755
--- a/create_driver_version.py
+++ b/create_driver_version.py
@@ -88,8 +88,16 @@ def main():
 
     for reader in real_list:
         sys.stderr.write(reader + "\n")
-        res = subprocess.check_output(['git', '--no-pager', 'log',
-                                   '--pretty=format:%at', reader])
+
+        # cache mechanism
+        try:
+            with open("../../website/.cache/" + reader) as f:
+                res = f.read()
+        except:
+            res = subprocess.check_output(['git', '--no-pager', 'log',
+                                       '--pretty=format:%at', reader])
+            with open("../../website/.cache/" + reader, "a") as f:
+                f.write(res)
 
         # get a list of commit time stamps
         commits = res.split('\n')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/website.git



More information about the Pcsclite-cvs-commit mailing list