Last active
October 27, 2019 18:55
-
-
Save Amar1729/9500b8878f1f90546bf32e1414534553 to your computer and use it in GitHub Desktop.
Proposed fixes for some pyrocore files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e8f099e3be53311cfec4bde0699de9559e972cb5 Mon Sep 17 00:00:00 2001 | |
From: Amar1729 <[email protected]> | |
Date: Tue, 22 Oct 2019 03:14:48 -0400 | |
Subject: [PATCH 1/1] fix update-to-head script (more robust) | |
--- | |
pavement.py | 12 +++++++----- | |
update-to-head.sh | 28 +++++++++++++++------------- | |
2 files changed, 22 insertions(+), 18 deletions(-) | |
diff --git a/pavement.py b/pavement.py | |
index d9c1316..cc53727 100644 | |
--- a/pavement.py | |
+++ b/pavement.py | |
@@ -347,19 +347,21 @@ def functest(): | |
@task | |
def installtest(): | |
"test of fresh installation" | |
- testdir = path("build/install-test") | |
+ testdir = path("/tmp/pyrocore-test") | |
if testdir.exists(): | |
testdir.rmtree() | |
- if os.environ.get('TRAVIS', '').lower() == 'true': | |
- sh("git clone https://github.com/pyroscope/pyrocore.git " + testdir) | |
- else: | |
- sh("git clone . " + testdir) | |
+ # dont reclone (won't work even work in Travis for nonmaster branches), just copy | |
+ sh("scp -r . " + testdir) | |
+ testdir_git = testdir / ".git" | |
+ if testdir_git.exists(): | |
+ testdir_git.rmtree() | |
testbin = testdir / "test-bin" | |
testbin.makedirs() | |
os.environ["BIN_DIR"] = testbin.abspath() | |
os.environ["PROJECT_ROOT"] = '' | |
+ os.environ["PYROCORE_NO_DOWNLOAD"] = '1' | |
with pushd(testdir): | |
sh("./update-to-head.sh") | |
sh("./test-bin/pyroadmin --version") | |
diff --git a/update-to-head.sh b/update-to-head.sh | |
index d6211f1..7491868 100755 | |
--- a/update-to-head.sh | |
+++ b/update-to-head.sh | |
@@ -1,12 +1,13 @@ | |
#! /bin/bash | |
-git_projects="pyrobase" | |
# Find most suitable Python | |
echo "~~~ On errors, paste EVERYTHING below ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | |
deactivate 2>/dev/null | |
PYTHON="$1" | |
-test -z "$PYTHON" -a -x "/usr/bin/python2" && PYTHON="/usr/bin/python2" | |
-test -z "$PYTHON" -a -x "/usr/bin/python" && PYTHON="/usr/bin/python" | |
+# prefer python3 | |
+test -z "$PYTHON" -a -x "/usr/bin/python3" && PYTHON="$(command -v python3)" | |
+test -z "$PYTHON" -a -x "/usr/bin/python2" && PYTHON="$(command -v python2)" | |
+test -z "$PYTHON" -a -x "/usr/bin/python" && PYTHON="$(command -v python)" | |
test -z "$PYTHON" && PYTHON="python" | |
set -e | |
@@ -33,6 +34,7 @@ assert sys.version_info[0:2] in [(2, 7), (3, 5), (3, 6)], "Use Python 2.7 or 3.5 | |
echo "Updating your installation..." | |
+if [[ -z $PYROCORE_NO_DOWNLOAD ]]; then | |
# Bootstrap if script was downloaded... | |
if test -d .git; then | |
git pull --ff-only | |
@@ -41,6 +43,7 @@ else | |
mv tmp/???* tmp/.??* .; rmdir tmp | |
MY_SUM="let's start over" | |
fi | |
+fi | |
if test "$MY_SUM" != $(md5sum "$0" | cut -f1 -d' '); then | |
echo -e "\n\n*** Update script changed, starting over ***\n" | |
@@ -50,23 +53,22 @@ fi | |
. "$PROJECT_ROOT/util.sh" # load funcs | |
# Ensure virtualenv is there | |
-test -f bin/activate || install_venv --never-download | |
+test -f bin/activate || install_venv --never-download -p $PYTHON | |
update_venv ./bin/pip | |
# Get base packages initially, for old or yet incomplete installations | |
-for project in $git_projects; do | |
- test -d $project || { echo "Getting $project..."; git clone "git://github.com/pyroscope/$project.git" $project; } | |
-done | |
+project="pyrobase" | |
+if [[ ! -d $project ]]; then | |
+ echo "Getting $project..." | |
+ # git clone "git://github.com/pyroscope/$project.git" $project | |
+ git clone --single-branch --branch py3 "git://github.com/kannibalox/$project.git" $project | |
+fi | |
# Update source | |
source bin/activate | |
-for project in $git_projects; do | |
- ( builtin cd $project && git pull -q --ff-only ) | |
-done | |
+# ( builtin cd $project && git pull -q --ff-only || true ) | |
source bootstrap.sh | |
-for project in $git_projects; do | |
- ( builtin cd $project && ../bin/paver -q develop -U ) | |
-done | |
+( builtin cd $project && ../bin/paver -q develop -U ) | |
ln -nfs python ./bin/python-pyrocore | |
if test -d ${BIN_DIR:-$HOME/bin}; then | |
-- | |
2.7.4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment