From 80267e8a1960822d094fbdf2e41f1ed714b4fc99 Mon Sep 17 00:00:00 2001 From: Jeremy Wiebe Date: Tue, 5 Jan 2021 10:22:18 -0800 Subject: [PATCH] Fixes for new machine install Summary: While re-installing onto a brand new install, I ran into several issues and noticed some things that are no longer needed. Specifically: * Installing `yarn` via homebrew has the potential to overwrite the `node` we have installed (usually with a newer version than we want). Instead, it's easiest to just use `npm` to install yarn globally. * `readline` is a [[ https://khanacademy.slack.com/archives/C02NMB1R5/p1606758044205900 | perenial ]] [[ https://khanacademy.slack.com/archives/C02NMB1R5/p1601497407132100 | problem ]] to get installed with `pip`. But our version of Python comes with `readline` packaged into it, and that version of readline properly switches between readline and libedit (macOS) depending on the OS it's on. I don't think we need to install the readline module manually any longer (see https://pypi.org/project/gnureadline/) * Don't force-install npm@6.4.1 - that breaks `make install_deps` in webapp Issue: "none" Test Plan: Well, I guess the best way would be to run this diff on a fresh install of macOS. Reviewers: ebrown, csilvers, benkraft Reviewed By: ebrown Subscribers: bryan, john, kevinb, jeff, csilvers Differential Revision: https://phabricator.khanacademy.org/D68282 --- mac-setup.sh | 11 +++-------- setup.sh | 11 ++--------- shared-functions.sh | 17 +---------------- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/mac-setup.sh b/mac-setup.sh index 56fb0c1..677e057 100755 --- a/mac-setup.sh +++ b/mac-setup.sh @@ -302,11 +302,6 @@ install_node() { notice "\t${tty_bold}brew link --force --overwrite node@12${tty_normal}" read -p "Press enter to continue..." fi - if ! which yarn >/dev/null 2>&1; then - # Using brew to install node 10 seems to prevent npm from - # correctly installing yarn. Use brew instead - brew install yarn - fi } install_go() { @@ -342,9 +337,9 @@ install_postgresql() { if [ "$pg11_brewname" = "NONE" ] ; then info "Installing postgresql\n" brew install postgresql@11 - # swtich icu4c to 64.2 - # if default verison is 63.x and v64.2 was installed by postgres@11 - if [ "$(brew ls icu4c --versions |grep "icu4c 63")" ] && \ + # switch icu4c to 64.2 + # if default version is 63.x and v64.2 was installed by postgres@11 + if [ "$(brew ls icu4c --versions | grep "icu4c 63")" ] && \ [ "$(brew ls icu4c | grep 64.2 >/dev/null 2>&1)" ]; then brew switch icu4c 64.2 fi diff --git a/setup.sh b/setup.sh index 55ef7e7..31364a7 100755 --- a/setup.sh +++ b/setup.sh @@ -254,16 +254,9 @@ install_deps() { create_and_activate_virtualenv "$ROOT/.virtualenv/khan27" - # Inspiration from this slack discussion - # https://khanacademy.slack.com/archives/C0918TZ5G/p1560899833202100 - # In general, need to pin npm to V6.4.1 - # Also, need to install yarn first before run `make install_deps` + # Need to install yarn first before run `make install_deps` # in webapp. - # TODO(avidal): Is this still necessary? That's an ancient version of npm - # and you can get yarn via brew or via your distribution. - if ! which yarn >/dev/null; then - echo "Installing yarn" - sudo npm install -g npm@6.4.1 + if ! which yarn >/dev/null 2>&1; then sudo npm install -g yarn fi diff --git a/shared-functions.sh b/shared-functions.sh index a9354d1..0041fb4 100644 --- a/shared-functions.sh +++ b/shared-functions.sh @@ -152,8 +152,7 @@ has_recent_go() { # Creates a webapp virtualenv in $1, if none exists, then activates it. # -# Assumes pip and virtualenv are already installed. Note this also -# pre-installs the correct readline on OS X -- see comments below. +# Assumes pip and virtualenv are already installed. # # Arguments: # $1: directory in which to put the virtualenv, typically ~/.virtualenv/khan27. @@ -164,20 +163,6 @@ create_and_activate_virtualenv() { # Activate the virtualenv. . "$1/bin/activate" - - # On OSX 10.15, we need to install an older version of readline - # so that when pip will not install the latest, which results - # in a library error trying to load readline/libreadline.a - # This must be done after installing the virtualenv. - if [ "`uname -s`" == "Darwin" ] && sw_vers -productVersion | grep -q -e '^10\.15\.'; then - echo "On OSX 10.15 - Installing readline 6.2.0" - if [ -z "$(pip --disable-pip-version-check freeze | grep readline)" ] ; then - # Long deprecated library - clang generates many warnings which - # cause build to fail. We add a -w here to disable *all* warnings. - # It is the only way found to get the install to work. - CFLAGS='-w' pip install https://pypi.python.org/packages/source/r/readline/readline-6.2.0.tar.gz - fi - fi } # If we exit unexpectedly, log this warning.