You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:53:53 UTC

[buildstream] 04/06: setup.py: Allow optionality of main entry point at install time.

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tristan/bst2-separation
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 548c977ddb15e0adcc98dbd0758bd30b007c5ba7
Author: Tristan Van Berkom <tr...@codethink.co.uk>
AuthorDate: Thu Apr 4 19:32:31 2019 +0900

    setup.py: Allow optionality of main entry point at install time.
    
    By default, we now install as `bst2` so as to not overlap with
    `bst` which is BuildStream 1.
    
    However, as it does not pose any problem to install as `bst`, we
    allow it. The expectation is that once 2.0 is released, distros will
    probably install `bst1` and `bst2` separately, but alias the `bst`
    command to the latest version (e.g., like the debian 'alternatives' concept).
---
 setup.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 02cc29e..7076e8b 100755
--- a/setup.py
+++ b/setup.py
@@ -131,10 +131,24 @@ bst_install_entry_points = {
     ],
 }
 
+#
+# By default BuildStream 2 installs as 'bst2', but allow
+# the installer to override this and install as 'bst' if
+# they wish
+#
+bst_entry_point = os.environ.get('BST_ENTRY_POINT', '')
+if not bst_entry_point:
+    bst_entry_point = 'bst2'
+
+if bst_entry_point not in ('bst', 'bst2'):
+    print("BST_ENTRY_POINT was set to '{}'".format(bst_entry_point) +
+          ", but only 'bst' or 'bst2' is allowed")
+    sys.exit(1)
+
 if not os.environ.get('BST_ARTIFACTS_ONLY', ''):
     check_for_bwrap()
     bst_install_entry_points['console_scripts'] += [
-        'bst = buildstream2._frontend:cli'
+        '{} = buildstream2._frontend:cli'.format(bst_entry_point)
     ]
 
 #####################################################