gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-landing] branch master updated (b7c30fd -> a4fb571)


From: gnunet
Subject: [GNUnet-SVN] [taler-landing] branch master updated (b7c30fd -> a4fb571)
Date: Tue, 15 Oct 2019 09:24:52 +0200

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

dold pushed a change to branch master
in repository landing.

    from b7c30fd  add bootstrap script
     new a5d36ac  simpler and better build system
     new a4fb571  allow 'make install' to prefix

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitignore                       |  20 ++------
 .gitmodules                      |   3 ++
 Makefile                         |  24 +++++++++
 Makefile.am                      |   1 -
 bootstrap                        |   5 +-
 build-system/taler-build-scripts |   1 +
 configure.ac                     |   7 ---
 configure.py                     |   6 +++
 demo/Makefile.am                 |   7 ---
 demo/static/Makefile.am          |   1 -
 demo/static/web-common           |   2 +-
 demo/template.py                 | 107 ++++++++++++++++++++++++---------------
 12 files changed, 108 insertions(+), 76 deletions(-)
 create mode 100644 Makefile
 delete mode 100644 Makefile.am
 create mode 160000 build-system/taler-build-scripts
 delete mode 100644 configure.ac
 create mode 100644 configure.py
 delete mode 100644 demo/Makefile.am
 delete mode 100644 demo/static/Makefile.am

diff --git a/.gitignore b/.gitignore
index 99a596a..837c9f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,17 +1,3 @@
-Makefile
-Makefile.in
-aclocal.m4
-autom4te.cache/
-configure
-config.log
-config.status
-install-sh
-missing
-demo/Makefile
-demo/Makefile.in
-demo/de/
-demo/en/
-demo/es/
-demo/it/
-demo/static/Makefile
-demo/static/Makefile.in
+/build
+/configure
+/config.mk
diff --git a/.gitmodules b/.gitmodules
index b20bc28..a26e012 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -3,3 +3,6 @@
        url = git://git.taler.net/web-common
        branch = master
         ignore = dirty
+[submodule "build-system/taler-build-scripts"]
+       path = build-system/taler-build-scripts
+       url = git://git.taler.net/taler-build-scripts.git
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6e4cf5c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,24 @@
+SHELL = /bin/sh
+
+-include config.mk
+
+.PHONY: all
+all:
+       ./demo/template.py build
+
+.PHONY: clean
+clean:
+       rm -rf build
+
+.PHONY: install
+ifndef prefix
+.PHONY: warn-noprefix
+warn-noprefix:
+       @echo "no prefix configured, did you run ./configure?"
+       @false
+install: warn-noprefix
+else
+install: all
+       mkdir -p $(prefix)/share/taler-landing
+       cp -r build/* $(prefix)/share/taler-landing/
+endif
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index 0f41786..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = demo
diff --git a/bootstrap b/bootstrap
index c83fd8c..747df53 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+# Bootstrap the repository.  Used when the repository is checked out from git.
+# When using the source tarball, running this script is not necessary.
+
 set -eu
 
 if ! git --version >/dev/null; then
@@ -8,4 +11,4 @@ if ! git --version >/dev/null; then
 fi
 
 git submodule update --init
-AUTOMAKE="automake --foreign" autoreconf -fiv
+ln -sf build-system/taler-build-scripts/configure ./configure
diff --git a/build-system/taler-build-scripts b/build-system/taler-build-scripts
new file mode 160000
index 0000000..4272384
--- /dev/null
+++ b/build-system/taler-build-scripts
@@ -0,0 +1 @@
+Subproject commit 4272384edde63ba46c5713490f5e92146187fc77
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index fffd9e1..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,7 +0,0 @@
-AC_INIT(taler-demo-landing-page, 0.1, address@hidden)
-AM_INIT_AUTOMAKE
-# check for typescript compiler
-AC_CHECK_PROG([tsc],[tsc],[yes],[no])
-AM_CONDITIONAL(HAVE_TSC, [ test "$tsc" = "yes"])
-AC_CONFIG_FILES(Makefile demo/Makefile demo/static/Makefile 
demo/static/web-common/Makefile)
-AC_OUTPUT
diff --git a/configure.py b/configure.py
new file mode 100644
index 0000000..40000b3
--- /dev/null
+++ b/configure.py
@@ -0,0 +1,6 @@
+from talerbuildconfig import *
+
+b = BuildConfig()
+b.enable_prefix()
+b.enable_configmk()
+b.run()
diff --git a/demo/Makefile.am b/demo/Makefile.am
deleted file mode 100644
index e016510..0000000
--- a/demo/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-pkgdata_DATA = index.html.j2
-SUBDIRS = static
-
-.PHONY: all
-
-all:
-       ./template.py
diff --git a/demo/static/Makefile.am b/demo/static/Makefile.am
deleted file mode 100644
index a0d2051..0000000
--- a/demo/static/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = web-common
diff --git a/demo/static/web-common b/demo/static/web-common
index ba4a54c..0968eb3 160000
--- a/demo/static/web-common
+++ b/demo/static/web-common
@@ -1 +1 @@
-Subproject commit ba4a54c65786f35922616175b644f9db7897c87e
+Subproject commit 0968eb3d4023a8a0a37f7069f162eb786a6e04d2
diff --git a/demo/template.py b/demo/template.py
index 05599e4..01d778b 100755
--- a/demo/template.py
+++ b/demo/template.py
@@ -17,66 +17,91 @@ import glob
 import codecs
 import os
 import os.path
+import click
+import shutil
+from pathlib import Path
 
-env = 
jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
-        extensions=["jinja2.ext.i18n"],
-        lstrip_blocks=True,
-        trim_blocks=True,
-
-        undefined=jinja2.StrictUndefined,
-                         autoescape=False)
+env = jinja2.Environment(
+    
loader=jinja2.FileSystemLoader(os.path.realpath(os.path.dirname(__file__))),
+    extensions=["jinja2.ext.i18n"],
+    lstrip_blocks=True,
+    trim_blocks=True,
+    undefined=jinja2.StrictUndefined,
+    autoescape=False,
+)
 
 default_ctx = {}
 default_ctx["merchant_blog_url"] = 
os.environ.get("TALER_ENV_URL_MERCHANT_BLOG", "#")
-default_ctx["merchant_donations_url"] = 
os.environ.get("TALER_ENV_URL_MERCHANT_DONATIONS", "#")
-default_ctx["merchant_survey_url"] = 
os.environ.get("TALER_ENV_URL_MERCHANT_SURVEY", "#")
+default_ctx["merchant_donations_url"] = os.environ.get(
+    "TALER_ENV_URL_MERCHANT_DONATIONS", "#"
+)
+default_ctx["merchant_survey_url"] = os.environ.get(
+    "TALER_ENV_URL_MERCHANT_SURVEY", "#"
+)
 default_ctx["intro_url"] = os.environ.get("TALER_ENV_URL_INTRO", "#")
 default_ctx["bank_url"] = os.environ.get("TALER_ENV_URL_BANK", "#")
 default_ctx["auditor_url"] = os.environ.get("TALER_ENV_URL_AUDITOR", "#")
 default_ctx["backoffice_url"] = os.environ.get("TALER_ENV_URL_BACKOFFICE", "#")
 
 
-for in_file in glob.glob("*.j2"):
-    name, ext = re.match(r"(.*)\.([^.]+)$", in_file.rstrip(".j2")).groups()
-    tmpl = env.get_template(in_file)
+@click.command()
+@click.argument("outdir")
+def generate_site(outdir):
+    """Generate the site from templates."""
+    out_path = Path.cwd().joinpath(outdir)
+    os.chdir(os.path.dirname(os.path.realpath(__file__)))
+    os.makedirs(out_path.as_posix(), exist_ok=True)
+    for in_file in glob.glob("*.j2"):
+        name, ext = re.match(r"(.*)\.([^.]+)$", in_file.rstrip(".j2")).groups()
+        tmpl = env.get_template(in_file)
+
+        def self_localized(other_locale):
+            """
+            Return URL for the current page in another locale.
+            """
+            return "../" + other_locale + "/" + in_file.rstrip(".j2")
 
-    def self_localized(other_locale):
-        """
-        Return URL for the current page in another locale.
-        """
-        return "../" + other_locale + "/" + in_file.rstrip(".j2")
+        def url_localized(filename):
+            return "../" + locale + "/" + filename
 
-    def url_localized(filename):
-        return "../" + locale + "/" + filename
+        def url(x):
+            # TODO: look at the app root environment variable
+            # TODO: check if file exists
+            return "../" + x
 
-    def url(x):
-        # TODO: look at the app root environment variable
-        # TODO: check if file exists
-        return "../" + x
+        for l in ("en", "de", "it", "es"):
+            locale = os.path.basename(l)
 
-    for l in ("en", "de", "it", "es"):
-        locale = os.path.basename(l)
+            if os.path.isdir(os.path.join("./locale/", locale)):
+                tr = gettext.translation(
+                    "messages", localedir="locale", languages=[locale]
+                )
 
-        if os.path.isdir(os.path.join("./locale/", locale)):
-            tr = gettext.translation("messages",
-                                     localedir="locale",
-                                     languages=[locale])
+                env.install_gettext_translations(tr, newstyle=True)
+            else:
+                print("warning: locale {} not found".format(locale))
 
-            env.install_gettext_translations(tr, newstyle=True)
-        else:
-            print("warning: locale {} not found".format(locale))
-        
-        ctx = dict(
+            ctx = dict(
                 lang=locale,
                 url=url,
                 self_localized=self_localized,
                 url_localized=url_localized,
-                filename=name + "." + ext)
-        ctx.update(default_ctx)
+                filename=name + "." + ext,
+            )
+            ctx.update(default_ctx)
+
+            content = tmpl.render(**ctx)
+            out_name = (out_path / locale / in_file.rstrip(".j2")).as_posix()
+            os.makedirs((out_path / locale).as_posix(), exist_ok=True)
+
+            with codecs.open(out_name, "w", "utf-8") as f:
+                f.write(content)
+
+    for p in Path.cwd().glob("static/**/*.css"):
+        target = out_path / p.relative_to(Path.cwd())
+        target.parent.mkdir(parents=True, exist_ok=True)
+        shutil.copy(p, target)
 
-        content = tmpl.render(**ctx)
-        out_name = "./" + locale + "/" + in_file.rstrip(".j2")
-        os.makedirs("./" + locale, exist_ok=True)
 
-        with codecs.open(out_name, "w", "utf-8") as f:
-            f.write(content)
+if __name__ == "__main__":
+    generate_site()

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



reply via email to

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