gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[www_shared] 03/19: drop sum.py, remove function from fileproc.


From: gnunet
Subject: [www_shared] 03/19: drop sum.py, remove function from fileproc.
Date: Sat, 25 Jan 2020 11:29:18 +0100

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

ng0 pushed a commit to branch master
in repository www_shared.

commit 52e158a9be06cb4b94f8b8fc24137dc9345d8b05
Author: ng0 <address@hidden>
AuthorDate: Tue Nov 12 22:16:26 2019 +0000

    drop sum.py, remove function from fileproc.
---
 README.text |  4 ++++
 fileproc.py | 24 ------------------------
 sum.py      | 33 ---------------------------------
 3 files changed, 4 insertions(+), 57 deletions(-)

diff --git a/README.text b/README.text
index 27217b1..be70b01 100644
--- a/README.text
+++ b/README.text
@@ -1 +1,5 @@
 Common shared components for the websites of GNUnet and Taler.
+
+This is meant to be imported by a jinja2 project with a
+structure equivalent to https://git.gnunet.org/www.git
+or https://git.taler.net/www.git.
diff --git a/fileproc.py b/fileproc.py
index bf6cc8d..d0d4353 100644
--- a/fileproc.py
+++ b/fileproc.py
@@ -72,27 +72,3 @@ def localized(filename, locale, *args):
             return "../" + filename + "." + ext
         else:
             return "../" + lf
-
-
-# This generates and switches sites generations, preventing
-# in-place modification of the website.
-# * save old generation directory name
-# * jinja2 creates content in "rendered" (happened before calling this 
function)
-# * calculate sum of "rendered"
-# * move "rendered" to out/$sum
-# * remove symlink "html_dir"
-# * symlink out/$sum to "html_dir"
-# * delete old generation directory
-def generation_dir(htmldir):
-    oldgen = Path(htmldir).resolve()
-    # precondition: jinja2 has created the files in "rendered".
-    newgen = Path("rendered")
-    newgen_sum = walksum(newgen)
-    outdir = Path("out")
-    outdir.mkdir(parents=True, exist_ok=True)
-    newgen_target = Path("out") / newgen_sum
-    newgen.rename(newgen_target)
-    html = Path(htmldir)
-    html.unlink()
-    fileop(newgen, html, "link")
-    rm_rf(oldgen)
diff --git a/sum.py b/sum.py
deleted file mode 100644
index fff7a81..0000000
--- a/sum.py
+++ /dev/null
@@ -1,33 +0,0 @@
-def sha256sum(_):
-    sha256 = hashlib.sha256()
-    with io.open(_, mode="rb") as fd:
-        content = fd.read()
-        sha256.update(content)
-    return sha256.hexdigest()
-
-
-def walksum(_):
-    sha256 = hashlib.sha256()
-    x = Path(_)
-    if not x.exists():
-        return -1
-    try:
-        for root, directories, files in os.walk(_):
-            for names in sorted(files):
-                filepath = os.path.join(root, names)
-                try:
-                    fl = open(filepath, 'rb')
-                except:
-                    fl.close()
-                    continue
-                while 1:
-                    buf = fl.read(4096)
-                    if not buf:
-                        break
-                    sha256.update(hashlib.sha256(buf).hexdigest())
-                fl.close()
-    except:
-        import traceback
-        traceback.print_exc()
-        return -2
-    return sha256.hexdigest()

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]