Merge branch 'build-improvements'
* build-improvements: simplify build, almost remove python Fix build script to permit paths with spaces
This commit is contained in:
commit
aa3762c100
6 changed files with 37 additions and 58 deletions
13
README.md
13
README.md
|
@ -18,16 +18,15 @@ Our [releases page](https://github.com/lbryio/lbry-app/releases/latest) also con
|
||||||
|
|
||||||
To install from source or make changes to the application, continue reading below.
|
To install from source or make changes to the application, continue reading below.
|
||||||
|
|
||||||
## Development
|
## Development on Linux and macOS
|
||||||
|
|
||||||
### One-time Setup
|
### One-time Setup
|
||||||
|
|
||||||
1. Install npm and node (v6 and above required, use [nvm](https://github.com/creationix/nvm/blob/master/README.md) if having trouble)
|
1. Clone this repo
|
||||||
2. Install keytar and libsecret (see [keytar repository](https://github.com/atom/node-keytar) )
|
2. `DEPS=true ./build.sh`
|
||||||
3. Install yarn by running: npm install -g yarn (may require elevated permissions)
|
|
||||||
4. Check out this repo.
|
This will download and install the LBRY app and its dependencies, including [the LBRY daemon](https://github.com/lbryio/lbry) and command line utilities like `node` and `yarn`. \
|
||||||
5. Set up a Python virtual environment, or live on the wild side.
|
The LBRY app requires Node >= 6; if you have an earlier version of Node installed and want to keep it, you can use [nvm](https://github.com/creationix/nvm) to switch back and forth.
|
||||||
6. Run `./build.sh`. This builds the UI assets and puts them into `app/dist`. It also downloads [lbry daemon](https://github.com/lbryio/lbry/releases).
|
|
||||||
|
|
||||||
### Running
|
### Running
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"version": "0.18.0rc4",
|
"version": "0.18.0rc4",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
|
||||||
|
"homepage": "https://github.com/lbryio/lbry-app",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "LBRY Inc.",
|
"name": "LBRY Inc.",
|
||||||
"email": "hello@lbry.io"
|
"email": "hello@lbry.io"
|
||||||
|
|
2
build.sh
2
build.sh
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# this is here because teamcity runs /build.sh to build the project
|
# this is here because teamcity runs /build.sh to build the project
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
$DIR/build/build.sh
|
"$DIR/build/build.sh"
|
||||||
|
|
|
@ -29,25 +29,14 @@ FULL_BUILD="${FULL_BUILD:-false}"
|
||||||
if [ -n "${TEAMCITY_VERSION:-}" -o -n "${APPVEYOR:-}" ]; then
|
if [ -n "${TEAMCITY_VERSION:-}" -o -n "${APPVEYOR:-}" ]; then
|
||||||
FULL_BUILD="true"
|
FULL_BUILD="true"
|
||||||
fi
|
fi
|
||||||
if [ "$FULL_BUILD" != "true" ]; then
|
|
||||||
echo -e "\033[1;36mDependencies will NOT be installed. Run with 'FULL_BUILD=true' to install dependencies.\x1b[m"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$FULL_BUILD" == "true" ]; then
|
DEPS="${DEPS:-$FULL_BUILD}"
|
||||||
|
if [ "$DEPS" != "true" ]; then
|
||||||
|
echo -e "\033[1;36mDependencies will NOT be installed. Run with \"INSTALL_DEPENDENCIES=true\" to install dependencies, or \"FULL_BUILD=true\" to install dependencies and build a complete app.\x1b[m"
|
||||||
|
else
|
||||||
# install dependencies
|
# install dependencies
|
||||||
echo -e "\033[0;32mInstalling Dependencies\x1b[m"
|
echo -e "\033[0;32mInstalling Dependencies\x1b[m"
|
||||||
$BUILD_DIR/prebuild.sh
|
"$BUILD_DIR/install_deps.sh"
|
||||||
|
|
||||||
VENV="$BUILD_DIR/venv"
|
|
||||||
if [ -d "$VENV" ]; then
|
|
||||||
rm -rf "$VENV"
|
|
||||||
fi
|
|
||||||
virtualenv "$VENV"
|
|
||||||
set +u
|
|
||||||
source "$VENV/bin/activate"
|
|
||||||
set -u
|
|
||||||
pip install -r "$BUILD_DIR/requirements.txt"
|
|
||||||
python "$BUILD_DIR/set_version.py"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -d "$ROOT/dist" ] && rm -rf "$ROOT/dist"
|
[ -d "$ROOT/dist" ] && rm -rf "$ROOT/dist"
|
||||||
|
@ -90,7 +79,7 @@ DAEMON_URL=$(echo ${DAEMON_URL_TEMPLATE//DAEMONVER/$DAEMON_VER} | sed "s/OSNAME/
|
||||||
DAEMON_VER_PATH="$BUILD_DIR/daemon.ver"
|
DAEMON_VER_PATH="$BUILD_DIR/daemon.ver"
|
||||||
echo "$DAEMON_VER_PATH"
|
echo "$DAEMON_VER_PATH"
|
||||||
if [[ ! -f $DAEMON_VER_PATH || ! -f $ROOT/app/dist/lbrynet-daemon || "$(< "$DAEMON_VER_PATH")" != "$DAEMON_VER" ]]; then
|
if [[ ! -f $DAEMON_VER_PATH || ! -f $ROOT/app/dist/lbrynet-daemon || "$(< "$DAEMON_VER_PATH")" != "$DAEMON_VER" ]]; then
|
||||||
wget --quiet "$DAEMON_URL" -O "$BUILD_DIR/daemon.zip"
|
curl -sL -o "$BUILD_DIR/daemon.zip" "$DAEMON_URL"
|
||||||
unzip "$BUILD_DIR/daemon.zip" -d "$ROOT/app/dist/"
|
unzip "$BUILD_DIR/daemon.zip" -d "$ROOT/app/dist/"
|
||||||
rm "$BUILD_DIR/daemon.zip"
|
rm "$BUILD_DIR/daemon.zip"
|
||||||
echo "$DAEMON_VER" > "$DAEMON_VER_PATH"
|
echo "$DAEMON_VER" > "$DAEMON_VER_PATH"
|
||||||
|
@ -134,9 +123,13 @@ if [ "$FULL_BUILD" == "true" ]; then
|
||||||
# electron-build has a publish feature, but I had a hard time getting
|
# electron-build has a publish feature, but I had a hard time getting
|
||||||
# it to reliably work and it also seemed difficult to configure. Not proud of
|
# it to reliably work and it also seemed difficult to configure. Not proud of
|
||||||
# this, but it seemed better to write my own.
|
# this, but it seemed better to write my own.
|
||||||
python "$BUILD_DIR/upload_assets.py"
|
VENV="$BUILD_DIR/venv"
|
||||||
|
if [ -d "$VENV" ]; then
|
||||||
deactivate
|
rm -rf "$VENV"
|
||||||
|
fi
|
||||||
|
virtualenv "$VENV"
|
||||||
|
"$VENV/bin/pip" install -r "$BUILD_DIR/requirements.txt"
|
||||||
|
"$VENV/bin/python" "$BUILD_DIR/upload_assets.py"
|
||||||
|
|
||||||
echo -e '\033[0;32mBuild and packaging complete.\x1b[m'
|
echo -e '\033[0;32mBuild and packaging complete.\x1b[m'
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
set -x
|
|
||||||
|
|
||||||
|
|
||||||
LINUX=false
|
LINUX=false
|
||||||
OSX=false
|
OSX=false
|
||||||
|
@ -18,7 +16,7 @@ fi
|
||||||
|
|
||||||
|
|
||||||
SUDO=''
|
SUDO=''
|
||||||
if $LINUX && (( $EUID != 0 )); then
|
if (( $EUID != 0 )); then
|
||||||
SUDO='sudo'
|
SUDO='sudo'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -41,7 +39,7 @@ set -eu
|
||||||
|
|
||||||
if $LINUX; then
|
if $LINUX; then
|
||||||
INSTALL="$SUDO apt-get install --no-install-recommends -y"
|
INSTALL="$SUDO apt-get install --no-install-recommends -y"
|
||||||
$INSTALL build-essential libssl-dev libffi-dev libgmp3-dev python2.7-dev libsecret-1-dev wget
|
$INSTALL build-essential libssl-dev libffi-dev libgmp3-dev python2.7-dev libsecret-1-dev curl
|
||||||
elif $OSX && ! cmd_exists brew ; then
|
elif $OSX && ! cmd_exists brew ; then
|
||||||
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||||
fi
|
fi
|
||||||
|
@ -52,6 +50,9 @@ if ! cmd_exists python; then
|
||||||
$INSTALL python2.7
|
$INSTALL python2.7
|
||||||
elif $OSX; then
|
elif $OSX; then
|
||||||
brew install python
|
brew install python
|
||||||
|
else
|
||||||
|
echo "python2.7 required"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -64,11 +65,13 @@ fi
|
||||||
if ! cmd_exists pip; then
|
if ! cmd_exists pip; then
|
||||||
if $LINUX; then
|
if $LINUX; then
|
||||||
$INSTALL python-pip
|
$INSTALL python-pip
|
||||||
$SUDO pip install --upgrade pip
|
elif $OSX; then
|
||||||
|
$SUDO easy_install pip
|
||||||
else
|
else
|
||||||
echo "Pip required"
|
echo "pip required"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
$SUDO pip install --upgrade pip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $LINUX && [ "$(pip list --format=columns | grep setuptools | wc -l)" -ge 1 ]; then
|
if $LINUX && [ "$(pip list --format=columns | grep setuptools | wc -l)" -ge 1 ]; then
|
||||||
|
@ -85,6 +88,9 @@ if ! cmd_exists node; then
|
||||||
$INSTALL nodejs
|
$INSTALL nodejs
|
||||||
elif $OSX; then
|
elif $OSX; then
|
||||||
brew install node
|
brew install node
|
||||||
|
else
|
||||||
|
echo "node required"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -96,16 +102,17 @@ if ! cmd_exists yarn; then
|
||||||
$SUDO apt-get install yarn
|
$SUDO apt-get install yarn
|
||||||
elif $OSX; then
|
elif $OSX; then
|
||||||
brew install yarn
|
brew install yarn
|
||||||
|
else
|
||||||
|
echo "yarn required"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! cmd_exists unzip; then
|
if ! cmd_exists unzip; then
|
||||||
if $LINUX; then
|
if $LINUX; then
|
||||||
$INSTALL unzip
|
$INSTALL unzip
|
||||||
elif $OSX; then
|
else
|
||||||
echo "unzip required"
|
echo "unzip required"
|
||||||
exit 1
|
exit 1
|
||||||
# not sure this works, but OSX should come with unzip
|
|
||||||
# brew install unzip
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
|
@ -1,21 +0,0 @@
|
||||||
"""Set the package version to the output of `git describe`"""
|
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import os.path
|
|
||||||
import sys
|
|
||||||
import fileinput
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
filename = os.path.abspath(
|
|
||||||
os.path.join(os.path.abspath(__file__), '..', '..', 'ui', 'js', 'lbryio.js'))
|
|
||||||
for line in fileinput.input(filename, inplace=True):
|
|
||||||
if line.startswith(' enabled: false'):
|
|
||||||
print(' enabled: true')
|
|
||||||
else:
|
|
||||||
print(line, end='')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(main())
|
|
Loading…
Reference in a new issue