This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 152
Do not rely on Python2 to install Cloud9 dependencies #111
Open
andrewnester
wants to merge
2
commits into
c9:master
Choose a base branch
from
andrewnester:patch-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+27
−68
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -24,6 +24,8 @@ else | |||||
exit 1 | ||||||
fi | ||||||
|
||||||
# Specify the CDN URL using `PROD_CLOUDFRONT_URL=...`. Defaults to us-west-2 region url | ||||||
PROD_CLOUDFRONT_URL=${PROD_CLOUDFRONT_URL:-'https://dhj20r2nmszcd.cloudfront.net/static'} | ||||||
C9_DIR=$HOME/.c9 | ||||||
if [[ ${1-} == -d ]]; then | ||||||
C9_DIR=$2 | ||||||
|
@@ -36,8 +38,7 @@ if [ ! -d "$C9_DIR" ]; then | |||||
fi | ||||||
|
||||||
VERSION=1 | ||||||
NODE_VERSION=v6.3.1 | ||||||
NODE_VERSION_ARM_PI=v0.10.28 | ||||||
NODE_VERSION=v12.16.1 | ||||||
NPM=$C9_DIR/node/bin/npm | ||||||
NODE=$C9_DIR/node/bin/node | ||||||
|
||||||
|
@@ -73,20 +74,14 @@ start() { | |||||
case "$arch" in | ||||||
*arm64*) arch=arm64 ;; | ||||||
*aarch64*) arch=arm64 ;; | ||||||
*armv6l*) arch=armv6l ;; | ||||||
*armv7l*) arch=armv7l ;; | ||||||
*x86_64*) arch=x64 ;; | ||||||
*i*86*) arch=x86 ;; | ||||||
*) | ||||||
echo "Unsupported Architecture: $os $arch" 1>&2 | ||||||
exit 1 | ||||||
;; | ||||||
esac | ||||||
|
||||||
if [ "$arch" == "x64" ] && [[ $HOSTTYPE == i*86 ]]; then | ||||||
arch=x86 # check if 32 bit bash is installed on 64 bit kernel | ||||||
fi | ||||||
|
||||||
if [ "$os" != "linux" ] && [ "$os" != "darwin" ]; then | ||||||
echo "Unsupported Platform: $os $arch" 1>&2 | ||||||
exit 1 | ||||||
|
@@ -115,10 +110,6 @@ start() { | |||||
echo "sass - Sass" | ||||||
echo "typescript - TypeScript" | ||||||
echo "stylus - Stylus" | ||||||
# echo "go - Go" | ||||||
# echo "heroku - Heroku" | ||||||
# echo "rhc - RedHat OpenShift" | ||||||
# echo "gae - Google AppEngine" | ||||||
;; | ||||||
|
||||||
"install" ) | ||||||
|
@@ -156,7 +147,7 @@ start() { | |||||
echo $VERSION > "$C9_DIR"/installed | ||||||
|
||||||
cd "$C9_DIR" | ||||||
DOWNLOAD https://raw.githubusercontent.com/c9/install/master/packages/license-notice.md "Third-Party Licensing Notices.md" | ||||||
DOWNLOAD "$PROD_CLOUDFRONT_URL/license-notice.md" "Third-Party Licensing Notices.md" | ||||||
|
||||||
echo :Done. | ||||||
;; | ||||||
|
@@ -209,16 +200,14 @@ check_deps() { | |||||
} | ||||||
|
||||||
check_python() { | ||||||
if type -P python2.7 &> /dev/null; then | ||||||
PYTHONVERSION="2.7" | ||||||
PYTHON="python2.7" | ||||||
if type -P python3 &> /dev/null; then | ||||||
PYTHON="python3" | ||||||
elif type -P python &> /dev/null; then | ||||||
PYTHONVERSION=`python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))'` | ||||||
PYTHON="python" | ||||||
fi | ||||||
|
||||||
if [[ $PYTHONVERSION != "2.7" ]]; then | ||||||
echo "Python version 2.7 is required to install pty.js. Please install python 2.7 and try again. You can find more information on how to install Python in the docs: https://docs.aws.amazon.com/cloud9/latest/user-guide/ssh-settings.html#ssh-settings-requirements" | ||||||
if ! type -P "$PYTHON" &> /dev/null; then | ||||||
echo "Python version is required to install pty.js. Please install python and try again. You can find more information on how to install Python in the docs: https://docs.c9.io/ssh_workspaces.html" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
exit 100 | ||||||
fi | ||||||
} | ||||||
|
@@ -227,7 +216,7 @@ check_python() { | |||||
|
||||||
download_virtualenv() { | ||||||
VIRTUALENV_VERSION="virtualenv-12.0.7" | ||||||
DOWNLOAD "https://pypi.python.org/packages/source/v/virtualenv/$VIRTUALENV_VERSION.tar.gz" $VIRTUALENV_VERSION.tar.gz | ||||||
DOWNLOAD "$PROD_CLOUDFRONT_URL/$VIRTUALENV_VERSION.tar.gz" $VIRTUALENV_VERSION.tar.gz | ||||||
tar xzf $VIRTUALENV_VERSION.tar.gz | ||||||
rm $VIRTUALENV_VERSION.tar.gz | ||||||
mv $VIRTUALENV_VERSION virtualenv | ||||||
|
@@ -269,7 +258,7 @@ node(){ | |||||
|
||||||
echo :Installing Node $NODE_VERSION | ||||||
|
||||||
DOWNLOAD https://nodejs.org/dist/"$NODE_VERSION/node-$NODE_VERSION-$1-$2.tar.gz" node.tar.gz | ||||||
DOWNLOAD "$PROD_CLOUDFRONT_URL/node-$NODE_VERSION/node-$NODE_VERSION-$1-$2.tar.gz" node.tar.gz | ||||||
tar xzf node.tar.gz | ||||||
mv "node-$NODE_VERSION-$1-$2" node | ||||||
rm -f node.tar.gz | ||||||
|
@@ -323,12 +312,11 @@ tmux_download(){ | |||||
echo ":N.B: This will take a while. To speed this up install tmux 2.2 manually on your machine and restart this process." | ||||||
|
||||||
echo ":Downloading Libevent..." | ||||||
DOWNLOAD https://raw.githubusercontent.com/c9/install/master/packages/tmux/libevent-2.1.8-stable.tar.gz libevent-2.1.8-stable.tar.gz | ||||||
DOWNLOAD "$PROD_CLOUDFRONT_URL/libevent-2.1.8-stable.tar.gz" libevent-2.1.8-stable.tar.gz | ||||||
echo ":Downloading Ncurses..." | ||||||
DOWNLOAD https://github.com/c9/install/raw/master/packages/tmux/ncurses-6.0.tar.gz ncurses-6.0.tar.gz | ||||||
DOWNLOAD "$PROD_CLOUDFRONT_URL/ncurses-6.0.tar.gz" ncurses-6.0.tar.gz | ||||||
echo ":Downloading Tmux..." | ||||||
# DOWNLOAD https://raw.githubusercontent.com/c9/install/master/packages/tmux/tmux-1.9.tar.gz | ||||||
DOWNLOAD https://github.com/tmux/tmux/releases/download/2.2/tmux-2.2.tar.gz tmux-2.2.tar.gz | ||||||
DOWNLOAD "$PROD_CLOUDFRONT_URL/tmux-2.2.tar.gz" tmux-2.2.tar.gz | ||||||
} | ||||||
|
||||||
check_tmux_version(){ | ||||||
|
@@ -340,7 +328,7 @@ check_tmux_version(){ | |||||
return 1 | ||||||
fi | ||||||
|
||||||
if [ "$("$PYTHON" -c "print 1.7<=$tmux_version and $tmux_version <= 2.2")" == "True" ]; then | ||||||
if [ "$("$PYTHON" -c "print(1.7<=$tmux_version and $tmux_version <= 2.2)")" == "True" ]; then | ||||||
return 0 | ||||||
else | ||||||
return 1 | ||||||
|
@@ -361,26 +349,14 @@ tmux_install(){ | |||||
|
||||||
# If tmux is not present or at the wrong version, we will install it | ||||||
else | ||||||
if [ $os = "darwin" ]; then | ||||||
if ! has "brew"; then | ||||||
# http://brew.sh/ | ||||||
DOWNLOAD https://raw.githubusercontent.com/Homebrew/install/master/install installbrew | ||||||
ruby installbrew | ||||||
fi | ||||||
brew install tmux > /dev/null || | ||||||
(brew remove tmux &>/dev/null && brew install tmux >/dev/null) | ||||||
ln -sf "$(which tmux)" "$C9_DIR"/bin/tmux | ||||||
# Linux | ||||||
else | ||||||
if ! has "make"; then | ||||||
echo ":Could not find make. Please install make and try again." | ||||||
exit 100; | ||||||
fi | ||||||
|
||||||
tmux_download | ||||||
compile_tmux | ||||||
ln -sf "$C9_DIR"/local/bin/tmux "$C9_DIR"/bin/tmux | ||||||
if ! has "make"; then | ||||||
echo ":Could not find make. Please install make and try again." | ||||||
exit 100; | ||||||
fi | ||||||
|
||||||
tmux_download | ||||||
compile_tmux | ||||||
ln -sf "$C9_DIR"/local/bin/tmux "$C9_DIR"/bin/tmux | ||||||
fi | ||||||
|
||||||
if ! check_tmux_version "$C9_DIR"/bin/tmux; then | ||||||
|
@@ -391,12 +367,11 @@ tmux_install(){ | |||||
|
||||||
collab(){ | ||||||
echo :Installing Collab Dependencies | ||||||
"$NPM" cache clean | ||||||
"$NPM" install [email protected] | ||||||
"$NPM" install [email protected] | ||||||
"$NPM" install [email protected] | ||||||
mkdir -p "$C9_DIR"/lib | ||||||
cd "$C9_DIR"/lib | ||||||
DOWNLOAD https://raw.githubusercontent.com/c9/install/master/packages/sqlite3/linux/sqlite3.tar.gz sqlite3.tar.gz | ||||||
DOWNLOAD "$PROD_CLOUDFRONT_URL/sqlite3.tar.gz" sqlite3.tar.gz | ||||||
tar xzf sqlite3.tar.gz | ||||||
rm sqlite3.tar.gz | ||||||
ln -sf "$C9_DIR"/lib/sqlite3/sqlite3 "$C9_DIR"/bin/sqlite3 | ||||||
|
@@ -409,17 +384,17 @@ nak(){ | |||||
|
||||||
ptyjs(){ | ||||||
echo :Installing pty.js | ||||||
"$NPM" install node-pty-prebuilt@0.7.3 | ||||||
"$NPM" install @ionic/node-pty-prebuilt@0.9.1 | ||||||
|
||||||
if ! hasPty; then | ||||||
echo "Unknown exception installing pty.js" | ||||||
"$C9_DIR/node/bin/node" -e "console.log(require('node-pty-prebuilt'))" | ||||||
"$C9_DIR/node/bin/node" -e "console.log(require('@ionic/node-pty-prebuilt'))" | ||||||
exit 100 | ||||||
fi | ||||||
} | ||||||
|
||||||
hasPty() { | ||||||
local HASPTY=$("$C9_DIR/node/bin/node" -p "typeof require('node-pty-prebuilt').createTerminal=='function'" 2> /dev/null) | ||||||
local HASPTY=$("$C9_DIR/node/bin/node" -p "typeof require('@ionic/node-pty-prebuilt').createTerminal=='function'" 2> /dev/null) | ||||||
if [ "$HASPTY" != true ]; then | ||||||
return 1 | ||||||
fi | ||||||
|
@@ -450,22 +425,6 @@ stylus(){ | |||||
"$NPM" install stylus | ||||||
} | ||||||
|
||||||
# go(){ | ||||||
|
||||||
# } | ||||||
|
||||||
# heroku(){ | ||||||
|
||||||
# } | ||||||
|
||||||
# rhc(){ | ||||||
|
||||||
# } | ||||||
|
||||||
# gae(){ | ||||||
|
||||||
# } | ||||||
|
||||||
start "$@" | ||||||
|
||||||
# cleanup tmp files | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node 16 has known security issues—see https://nodejs.org/en/blog/release/v12.20.1/. Can we instead add
12.20.1
to our CDN and use that here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm
12.20.1
has security issues too. Maybe it would be better to use12.22.x
.12.22.9
is the version we current install at runtime.