Skip to content

Commit cde0818

Browse files
authored
Merge pull request #106 from rcaloras/2.2.0-dev
2.2.0 dev
2 parents bb16446 + c61104e commit cde0818

File tree

4 files changed

+42
-33
lines changed

4 files changed

+42
-33
lines changed

bashhub/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import platform
22

3-
__version__ = '2.1.3'
3+
__version__ = '2.2.0'
44

55
version_str = 'Bashhub {0} (python {1})'.format(__version__, platform.python_version())

install-bashhub.sh

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,39 @@ if [ -f ~/.bashrc ]; then
3636
fi
3737
'
3838

39-
python_command='
39+
PYTHON_VERSION_COMMAND='
4040
import sys
41-
if (3, 5, 0) < sys.version_info < (3, 9, 0):
41+
if (3, 5, 0) < sys.version_info < (3, 11, 0):
4242
sys.exit(0)
43-
elif (2, 7, 0) < sys.version_info < (3,0):
43+
elif (2, 7, 8) < sys.version_info < (3,0):
4444
sys.exit(0)
4545
else:
4646
sys.exit(-1)'
4747

48+
# Prefer Python 3 versions over Python 2
49+
PYTHON_VERSION_ARRAY=(
50+
"/usr/bin/python3"
51+
"python3"
52+
"python3.10"
53+
"python3.9"
54+
"python3.8"
55+
"python3.7"
56+
"python3.6"
57+
"python3.5"
58+
"python"
59+
"python2.7"
60+
"python27"
61+
"python2"
62+
)
63+
4864
bashhub_config=~/.bashhub/config
4965
backup_config=~/.bashhub.config.backup
5066
zshprofile=~/.zshrc
5167
fish_config="${XDG_CONFIG_HOME:-~/.config}/fish/config.fish"
5268

5369
# Optional parameter to specify a github branch
5470
# to pull from.
55-
github_branch=${1:-'2.1.3'}
71+
github_branch=${1:-'2.2.0'}
5672

5773
install_bashhub() {
5874
check_dependencies
@@ -61,12 +77,10 @@ install_bashhub() {
6177
}
6278

6379
get_and_check_python_version() {
64-
# Prefer Python 3 versions over python 2
65-
python_version_array=( "python3.8" "python3.7" "python3.6" "python3.5" "python3" "python" "python2.7" "python27" "python2")
6680

67-
for python_version in "${python_version_array[@]}"; do
81+
for python_version in "${PYTHON_VERSION_ARRAY[@]}"; do
6882
if type "$python_version" &> /dev/null; then
69-
if "$python_version" -c "$python_command"; then
83+
if "$python_version" -c "$PYTHON_VERSION_COMMAND"; then
7084
echo "$python_version"
7185
return 0
7286
fi
@@ -76,40 +90,31 @@ get_and_check_python_version() {
7690
return 1
7791
}
7892

93+
# Boostrap virtualenv via zipapp
94+
# Details https://virtualenv.pypa.io/en/latest/installation.html#via-zipapp
7995
download_and_install_env() {
80-
# Select current version of virtualenv:
81-
VERSION=16.7.10
82-
# Name your first "bootstrap" environment:
83-
INITIAL_ENV="env"
84-
# Options for your first environment:
85-
ENV_OPTS="--distribute"
86-
87-
# Only supporting 2.7 right now.
88-
python_command=$(get_and_check_python_version)
96+
local python_command=$(get_and_check_python_version)
8997
if [[ -z "$python_command" ]]; then
90-
die "\n Sorry you need to have python 3.5-3.8 or 2.7 installed. Please install it and rerun this script." 1
98+
die "\n Sorry you need to have python 3.5-3.10 or 2.7.9+ installed. Please install it and rerun this script." 1
9199
fi
92100

93101
# Set to whatever python interpreter you want for your first environment
94102
PYTHON=$(which $python_command)
95-
URL_BASE=https://pypi.python.org/packages/source/v/virtualenv
96-
97-
# --- Real work starts here ---
98-
curl -OL $URL_BASE/virtualenv-$VERSION.tar.gz
99-
tar xzf virtualenv-$VERSION.tar.gz
100-
101-
# Create the first "bootstrap" environment.
102103
echo "Using Python path $PYTHON"
103-
$PYTHON virtualenv-$VERSION/virtualenv.py "$ENV_OPTS" "$INITIAL_ENV"
104104

105-
# Remove our virtual env setup files we don't need anymore
106-
rm -rf virtualenv-$VERSION
107-
rm virtualenv-$VERSION.tar.gz
105+
VERSION=20.10.0
106+
VERSION_URL="https://github.com/pypa/get-virtualenv/raw/$VERSION/public/virtualenv.pyz"
107+
# Alternatively use latest url for most recent that should be 2.7-3.9+
108+
LATEST_URL="https://bootstrap.pypa.io/virtualenv/2.7/virtualenv.pyz"
109+
curl -OL $VERSION_URL
110+
# Create the first "bootstrap" environment.
111+
$PYTHON virtualenv.pyz -q env
112+
rm virtualenv.pyz
108113
}
109114

110115
check_dependencies() {
111116
if [ -z "$(get_and_check_python_version)" ]; then
112-
die "\n Sorry can't seem to find a version of python 3.5-3.8 or 2.7 installed" 1
117+
die "\n Sorry can't seem to find a version of python 3.5-3.10 or 2.7.9+ installed" 1
113118
fi
114119

115120
if [ -z "$(detect_shell_type)" ]; then

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
packages=find_packages(),
1717
include_package_data=True,
1818
install_requires=[
19-
'requests==2.23.0', 'jsonpickle==0.7.0', 'click==3.3',
19+
'requests==2.23.0', 'jsonpickle==2.0.0', 'click==6.7',
2020
'npyscreen==4.10.5', 'python-dateutil==2.8.1', 'pyCLI==2.0.3',
2121
'pymongo==3.10.1', 'inflection==0.3.1', 'humanize==1.0.0',
22-
'future==0.16.0', 'mock==3.0.5'
22+
'future==0.18.2', 'mock==3.0.5'
2323
],
2424
tests_require=tests_require,
2525
extras_require={'test': tests_require},

tests/shell/install-bashhub.bats

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ setup() {
3131

3232
@test "get_and_check_python_version should find python3 first" {
3333
# Mock up some fake responses here.
34+
python3.10() { return 1; }
35+
python3.9() { return 1; }
3436
python3.8() { return 1; }
3537
python3.7() { return 1; }
3638
python3.6() { return 1; }
@@ -53,6 +55,8 @@ setup() {
5355
# Mock up some fake responses here.
5456

5557
python3() { return 1; }
58+
python3.10() { return 1; }
59+
python3.9() { return 1; }
5660
python3.8() { return 1; }
5761
python3.7() { return 1; }
5862
python3.6() { return 1; }

0 commit comments

Comments
 (0)