Created
January 12, 2020 03:12
-
-
Save gitcrtn/2ccbfccce317c04ef2dedef5b66b824a to your computer and use it in GitHub Desktop.
Install Pebble SDK with patch to Ubuntu 64bit
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
#!/usr/bin/env bash | |
# | |
# Install Pebble SDK for Ubuntu 64bit (2020) | |
# | |
# switch to python2 | |
# install dependencies for sdk | |
mkdir $HOME/pebble-dev | |
cd $HOME/pebble-dev | |
if [ -x "$(command -v pyenv)" ]; then | |
pyenv local 2.7.17 | |
pip install virtualenv | |
else | |
sudo apt-get install python-pip python2.7-dev | |
sudo pip2 install virtualenv | |
fi | |
# download sdk | |
curl https://developer.rebble.io/s3.amazonaws.com/assets.getpebble.com/pebble-tool/pebble-sdk-4.5-linux64.tar.bz2 -O | |
tar xf pebble-sdk-4.5-linux64.tar.bz2 | |
# install sdk | |
cd $HOME/pebble-dev/pebble-sdk-4.5-linux64 | |
virtualenv --no-site-packages .env | |
source .env/bin/activate | |
sed -i -e "s/https:\/\/s3-us-west-2.amazonaws.com\/pebble-sdk-homebrew\/pypkjs-1.0.6.tar.gz/https:\/\/github.com\/Willow-Systems\/vagrant-pebble-sdk\/raw\/master\/pypkjs-1.0.6.tar.gz/g" ./requirements.txt | |
pip install -r requirements.txt | |
deactivate | |
# update PATH | |
export PATH=$HOME/pebble-dev/pebble-sdk-4.5-linux64/bin:$PATH | |
echo export PATH=\$HOME/pebble-dev/pebble-sdk-4.5-linux64/bin:\$PATH >> $HOME/.bashrc | |
# install dependencies for emulator | |
sudo apt-get install libsdl1.2debian libfdt1 libpixman-1-0 | |
# install dependencies for sdk-core | |
cd $HOME | |
if ! [ -x "$(command -v npm)" ]; then | |
if ! [ -x "$(command -v nodebrew)" ]; then | |
curl -L git.io/nodebrew | perl - setup | |
export PATH=$HOME/.nodebrew/current/bin:$PATH | |
echo export PATH=\$HOME/.nodebrew/current/bin:\$PATH >> $HOME/.bashrc | |
fi | |
nodebrew install-binary v12.14.1 | |
nodebrew use v12.14.1 | |
fi | |
# patch pebble-tool to ignore old server | |
cd $HOME/pebble-dev/pebble-sdk-4.5-linux64/pebble-tool | |
patch -p1 --ignore-whitespace << 'EOF' | |
diff --git a/pebble_tool/account.py b/pebble_tool/account.py | |
index e263656..02f1730 100644 | |
--- a/pebble_tool/account.py | |
+++ b/pebble_tool/account.py | |
@@ -113,6 +113,9 @@ class Account(object): | |
with open(file_path) as f: | |
return json.load(f) | |
except (IOError, ValueError): | |
+ # Not supported | |
+ return None | |
+ | |
with open(file_path, 'w') as f: | |
result = requests.get(ME_URI, headers={'Authorization': 'Bearer %s' % self.get_access_token()}) | |
result.raise_for_status() | |
diff --git a/pebble_tool/commands/sdk/__init__.py b/pebble_tool/commands/sdk/__init__.py | |
index b085354..57106c0 100644 | |
--- a/pebble_tool/commands/sdk/__init__.py | |
+++ b/pebble_tool/commands/sdk/__init__.py | |
@@ -51,5 +51,5 @@ class SDKCommand(BaseCommand): | |
def __call__(self, args): | |
super(SDKCommand, self).__call__(args) | |
self.sdk = args.sdk | |
- self._fix_python() | |
+ # self._fix_python() | |
self.add_arm_tools_to_path() | |
diff --git a/pebble_tool/commands/sdk/manage.py b/pebble_tool/commands/sdk/manage.py | |
index 354ff0d..04bbe8c 100644 | |
--- a/pebble_tool/commands/sdk/manage.py | |
+++ b/pebble_tool/commands/sdk/manage.py | |
@@ -81,6 +81,9 @@ class SDKManager(BaseCommand): | |
channel_text = '' | |
print("Available SDKs{}:".format(channel_text)) | |
try: | |
+ # Not supported | |
+ raise requests.RequestException | |
+ | |
for sdk in sdk_manager.list_remote_sdks(): | |
if sdk['version'] in local_sdk_versions: | |
continue | |
diff --git a/pebble_tool/sdk/manager.py b/pebble_tool/sdk/manager.py | |
index 9f28a70..e8cfe8a 100644 | |
--- a/pebble_tool/sdk/manager.py | |
+++ b/pebble_tool/sdk/manager.py | |
@@ -140,16 +140,21 @@ class SDKManager(object): | |
raise | |
def install_remote_sdk(self, version): | |
- sdk_info = self.request("/v1/files/sdk-core/{}?channel={}".format(version, self.get_channel())).json() | |
- if 'version' not in sdk_info: | |
- raise SDKInstallError("SDK {} could not be downloaded.".format(version)) | |
- path = os.path.normpath(os.path.join(self.sdk_dir, sdk_info['version'])) | |
- if os.path.exists(path): | |
- raise SDKInstallError("SDK {} is already installed.".format(sdk_info['version'])) | |
+ # sdk_info = self.request("/v1/files/sdk-core/{}?channel={}".format(version, self.get_channel())).json() | |
+ # if 'version' not in sdk_info: | |
+ # raise SDKInstallError("SDK {} could not be downloaded.".format(version)) | |
+ # path = os.path.normpath(os.path.join(self.sdk_dir, sdk_info['version'])) | |
+ # if os.path.exists(path): | |
+ # raise SDKInstallError("SDK {} is already installed.".format(sdk_info['version'])) | |
+ | |
# For now, we ignore this field aside from bailing if it has content. | |
- Requirements(sdk_info['requirements']).ensure_satisfied() | |
+ url = 'https://github.com/aveao/PebbleArchive/raw/master/SDKCores/sdk-core-4.3.tar.bz2' | |
+ reqs = ['pebble-tool>=4.4-beta4'] | |
+ # Requirements(sdk_info['requirements']).ensure_satisfied() | |
+ Requirements(reqs).ensure_satisfied() | |
self._license_prompt() | |
- self.install_from_url(sdk_info['url']) | |
+ # self.install_from_url(sdk_info['url']) | |
+ self.install_from_url(url) | |
def _license_prompt(self): | |
prompt = """To use the Pebble SDK, you must agree to the following: | |
diff --git a/pebble_tool/util/analytics.py b/pebble_tool/util/analytics.py | |
index af349ef..b812ced 100644 | |
--- a/pebble_tool/util/analytics.py | |
+++ b/pebble_tool/util/analytics.py | |
@@ -48,7 +48,8 @@ class PebbleAnalytics(threading.Thread): | |
return os.path.join(get_persist_dir(), "pending_analytics.json") | |
def run(self): | |
- should_track = self._should_track() | |
+ # should_track = self._should_track() | |
+ should_track = False | |
first_run = True | |
while first_run or self.should_run: | |
first_run = False | |
@@ -106,7 +107,8 @@ class PebbleAnalytics(threading.Thread): | |
'json': json.dumps(td_obj) | |
} | |
if force: | |
- requests.post(self.TD_SERVER, data=fields) | |
+ # requests.post(self.TD_SERVER, data=fields) | |
+ logger.debug("POST to server: %s" % fields) | |
logger.debug("Synchronously transmitting analytics data: {}".format(analytics)) | |
else: | |
logger.debug("Queueing analytics data: {}".format(analytics)) | |
EOF | |
# refresh PATH | |
source $HOME/.bashrc |
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
#!/usr/bin/env bash | |
# | |
# Try to install hello_world to pebble | |
# | |
usage="$(basename "$0") [-h] [-p ip] -- build and install hello_world to pebble | |
where: | |
-h show this help text | |
-p phone IP by developer mode" | |
server_ip=none | |
while getopts ':hp:' option; do | |
case "$option" in | |
h) echo "$usage" | |
exit | |
;; | |
p) server_ip=$OPTARG | |
;; | |
:) printf "Error: missing argument for -%s\n" "$OPTARG" >&2 | |
echo "$usage" >&2 | |
exit 1 | |
;; | |
\?) printf "Error: illegal option: -%s\n" "$OPTARG" >&2 | |
echo "$usage" >&2 | |
exit 1 | |
;; | |
esac | |
done | |
if [ ${server_ip} = "none" ]; then | |
echo "$usage" >&2 | |
exit 1 | |
fi | |
echo "Phone IP: ${server_ip}" | |
ping ${server_ip} -c 1 >> /dev/null | |
if [ $? -ne 0 ]; then | |
echo "Error: Phone IP Unreachable" | |
exit 1 | |
fi | |
cd /tmp | |
tmp_dir=$(mktemp -d tmp.XXXXXX) | |
cd ${tmp_dir} | |
pebble new-project hello_world | |
cd hello_world | |
echo "Start building..." | |
pebble build | |
if [ $? -ne 0 ]; then | |
echo "Error: build failed" | |
exit 1 | |
fi | |
echo "Start installing..." | |
pebble install --phone ${server_ip} | |
if [ $? -ne 0 ]; then | |
echo "Error: install failed" | |
exit 1 | |
fi | |
cd /tmp | |
rm -rf ${tmp_dir} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment