gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-merchant-demos] branch master updated: use venv for install


From: gnunet
Subject: [taler-taler-merchant-demos] branch master updated: use venv for installation
Date: Thu, 23 Feb 2023 23:24:30 +0100

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

dold pushed a commit to branch master
in repository taler-merchant-demos.

The following commit(s) were added to refs/heads/master by this push:
     new 245e2ae  use venv for installation
245e2ae is described below

commit 245e2ae15c1f770bf6e8953fe951795a9d2461ea
Author: Florian Dold <florian@dold.me>
AuthorDate: Thu Feb 23 23:24:06 2023 +0100

    use venv for installation
---
 .gitignore                       |   1 +
 .gitmodules                      |   3 +
 Makefile                         |  22 +++----
 bootstrap                        |  29 ++++++++-
 build-system/configure.py        |  21 +++++++
 build-system/taler-build-scripts |   1 +
 configure                        | 129 ++++++++++++++++-----------------------
 7 files changed, 111 insertions(+), 95 deletions(-)

diff --git a/.gitignore b/.gitignore
index 23a69e0..845d547 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 translations/*/LC_MESSAGES/messages.mo
 config.mk
+.config.mk
 *~
 .sass-cache
 dist/
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..527bc74
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "build-system/taler-build-scripts"]
+       path = build-system/taler-build-scripts
+       url = git://git.taler.net/build-common
diff --git a/Makefile b/Makefile
index 5e3adff..403c64d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 install_global=false
--include config.mk
+-include .config.mk
 
 version := $(shell poetry version | awk '{ print $$2 }')
 
@@ -10,12 +10,6 @@ all:
 
 .PHONY: install
 
-ifeq ($(install_global), true)
-install: install-global
-else
-install: install-local
-endif
-
 setup-arch:
 # TODO: We should probabally add some form of "ignore me if already completed"
        set -e
@@ -56,15 +50,15 @@ setup-deb:
        pip install poetry
        echo "Done!"
 
-.PHONY: install-global
-install-global: compile
-       poetry build -f wheel
-       pip3 install --upgrade --ignore-installed 
"dist/talermerchantdemos-$(version)-py3-none-any.whl"
+my_venv = $(prefix)/lib/taler-merchant-demos/venv
 
-.PHONY: install-local
-install-local: compile
+.PHONY: install
+install: compile
+       mkdir -p $(prefix)/bin
        poetry build -f wheel
-       pip3 install --upgrade --ignore-installed --user 
"dist/talermerchantdemos-$(version)-py3-none-any.whl"
+       python3 -m venv $(my_venv)
+       $(my_venv)/bin/pip3 install --upgrade --ignore-installed 
"dist/talermerchantdemos-$(version)-py3-none-any.whl"
+       ln -sf $(my_venv)/bin/taler-merchant-demos 
$(prefix)/bin/taler-merchant-demos
 
 # run testcases
 .PHONY: check
diff --git a/bootstrap b/bootstrap
index fbf99b5..09a6fa0 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,5 +1,28 @@
 #!/bin/sh
 
-# This bootstrap script currently does nothing, but
-# is there for uniformity, since almost all our other
-# repos have a bootstrap script.
+# 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
+  echo "git not installed"
+  exit 1
+fi
+
+git submodule update --init
+
+copy_configure() {
+  src=$1
+  dst=$2
+  rm -f $dst
+  cp $src $dst
+  # Try making the configure script read-only to prevent
+  # accidental changes in the wrong place.
+  chmod ogu-w $dst || true
+}
+
+# To enable a GNU-style build system, we copy a configure
+# script to each package that can be installed
+our_configure=build-system/taler-build-scripts/configure
+copy_configure "$our_configure" ./configure
diff --git a/build-system/configure.py b/build-system/configure.py
new file mode 100644
index 0000000..f8e01aa
--- /dev/null
+++ b/build-system/configure.py
@@ -0,0 +1,21 @@
+# This configure.py file is places in the public domain.
+
+# Configure the build directory.
+# This file is invoked by './configure' and should usually not be invoked
+# manually.
+
+import talerbuildconfig as tbc
+import sys
+import shutil
+
+if getattr(tbc, "serialversion", 0) < 2:
+    print("talerbuildconfig outdated, please update the build-common submodule 
and/or bootstrap")
+    sys.exit(1)
+
+b = tbc.BuildConfig()
+b.enable_prefix()
+b.enable_configmk(dotfile=True)
+b.add_tool(tbc.PosixTool("make"))
+b.add_tool(tbc.PosixTool("zip"))
+b.add_tool(tbc.PosixTool("find"))
+b.run()
diff --git a/build-system/taler-build-scripts b/build-system/taler-build-scripts
new file mode 160000
index 0000000..2353867
--- /dev/null
+++ b/build-system/taler-build-scripts
@@ -0,0 +1 @@
+Subproject commit 23538677f6c6be2a62f38dc6137ecdd1c76b7b15
diff --git a/configure b/configure
index 469bad7..ad724cc 100755
--- a/configure
+++ b/configure
@@ -1,87 +1,60 @@
-#!/usr/bin/env bash
-
-set -eu
-
-usage() {
-  echo "Usage: ./configure [OPTION]"
-  echo
-  echo "Configuration:"
-  echo "  -h, --help              display this help and exit"
-  echo
-  echo "Installation directories:"
-  echo "  --destination=[local|global] install Python package locally or 
globally"
-}
-
-
-# -allow a command to fail with !’s side effect on errexit
-# -use return value from ${PIPESTATUS[0]}, because ! hosed $?
-! getopt --test > /dev/null
-if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
-    echo 'getopt not available'
-    exit 1
+#!/bin/sh
+
+# This file is part of GNU Taler.
+# (C) 2020 Taler Systems S.A.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
+# LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+# THIS SOFTWARE.
+#
+# SPDX-License-Identifier: 0BSD
+
+# This script checks if a suitable python3 executable is installed and then
+# executes the actual configure logic written in Python.
+
+build_system_dir=build-system
+
+if ! test -d "$build_system_dir"; then
+  # Maybe this is not a top-level configure invocation
+  # For monorepos, try location from top-level
+  build_system_dir=../../build-system
 fi
 
-LONGOPTS=destination:,help
-OPTIONS=h
-
-! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- 
"$@")
-if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
-    # e.g. return value is 1
-    #  then getopt has complained about wrong arguments to stdout
-    exit 2
+if ! test -d "$build_system_dir"; then
+  echo "fatal error: build-system directory not found" >&2
+  echo "hint: are you running this script from the right directory?" >&2
+  exit 1
 fi
 
-# read getopt’s output this way to handle the quoting right:
-eval set -- "$PARSED"
-
-destination="local"
-
-while true; do
-    case "$1" in
-      --destination)
-        destination="$2"
-        shift 2
-        ;;
-      -h|--help)
-        usage
-        exit 1
-        ;;
-      --)
-        shift
-        break
-        ;;
-      *)
-        echo "Programming error"
-        exit 3
-        ;;
-    esac
-done
-
-case "$destination" in
-  local)
-    install_global=false
-    ;;
-  global)
-    install_global=true
-    ;;
-  *)
-    echo "Destination (--destination) must be 'local' or 'global', paths are 
not allowed."
-    exit 3
-    ;;
-esac
-
-cat << EOF > config.mk
-# this file is autogenerated by ./configure
-install_global=$install_global
-EOF
-
-
-if ! python3 --version &>/dev/null; then
-  echo 'Error: python3 missing'
+scriptpath=$build_system_dir/taler-build-scripts
+if ! test -d "$build_system_dir"; then
+  echo "fatal error: taler-build-scripts directory not found at $scriptpath" 
>&2
+  echo "hint: did you run './bootstrap'?" >&2
   exit 1
 fi
 
-if ! pip3 --version &>/dev/null; then
-  echo 'Error: pip3 missing'
+export TALERBUILDSYSTEMDIR=$build_system_dir
+
+# Check that the python3 executable is on the PATH.
+# This follows PEP 394 (https://www.python.org/dev/peps/pep-0394/).
+if ! python3 --version >/dev/null 2>&1; then
+  echo "error: python3 not found" >&2
   exit 1
 fi
+
+# Let python3 check that its own version is okay for us.
+python3 "$scriptpath/pyvercheck.py" || exit $?
+
+# Allow Python to find libraries that are checked into the build system git.
+export PYTHONPATH="$scriptpath:${PYTHONPATH:-}"
+
+# Call configure.py, assuming all went well.
+python3 $TALERBUILDSYSTEMDIR/configure.py "$@"

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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