Compare commits

...
Author SHA1 Message Date
Alex Grintsvayg a021d7b200 Bump version: 0.9.0rc14 → 0.9.0rc15 2017-03-09 10:37:45 -05:00
Alex Grintsvayg f8a2a03ae8 fix lbryum release without tag 2017-03-09 10:37:35 -05:00
alexliebowitz b71382d276 Merge pull request #9 from lbryio/menubar
Add basic menubar
2017-03-08 18:23:04 -05:00
Alex Liebowitz 9c13a03ca6 Refactor and improve menubar
- Style fixes
 - Remove some items from Edit menu
 - Add app menu on macOS
 - Make Help point to help page instead of FAQ
 - Simplify menubar logic
2017-03-08 18:23:05 -05:00
Jeremy Kauffman 34c7da88c9 ignore venv 2017-03-08 09:55:45 -05:00
Alex Liebowitz b0d7e6497a Add basic menubar
This includes a Developer menu that can be enabled or disabled through
the UI.
2017-03-08 04:05:18 -05:00
Alex Grintsvayg 780f9dd7c5 Bump version: 0.9.0rc13 → 0.9.0rc14 2017-03-07 16:03:19 -05:00
Alex Grintsvayg 8f417005b5 finally working 2017-03-07 15:46:06 -05:00
Alex Grintsvayg df33156ea4 Bump version: 0.9.0rc12 → 0.9.0rc13 2017-03-06 18:15:45 -05:00
Alex Grintsvayg bb26e66d05 another fix 2017-03-06 18:00:57 -05:00
Alex Grintsvayg 9b6146cf0d Bump version: 0.9.0rc11 → 0.9.0rc12 2017-03-06 17:47:50 -05:00
Alex Grintsvayg ccfb56f717 fix 2017-03-06 17:47:10 -05:00
Alex Grintsvayg a3a3769222 Revert "Change submodules url to use ssh access"
This reverts commit 4386102ba3.

It turns out that Appveyor and Teamcity choke on SSH urls.
2017-03-06 17:40:21 -05:00
Alex Grintsvayg 3c100ecf20 minor 2017-03-06 17:17:03 -05:00
Alex Grintsvayg abbcbfefd7 move more requirements into req.txt 2017-03-06 11:52:34 -05:00
jobevers 33ffb322cc add script to reset each submodule 2017-03-06 10:34:37 -06:00
jobevers 5a2de41563 update submodules 2017-03-06 10:33:54 -06:00
jobevers 9ed1ba33be check if tag already exists 2017-03-06 10:33:17 -06:00
jobevers 86e52ffcb4 Add checks for token and lbryum part
Also adds better instructions and help items
2017-03-06 08:45:41 -06:00
jobevers 4bda5ac19a update submodules 2017-03-06 07:48:07 -06:00
jobevers 4386102ba3 Change submodules url to use ssh access
This change was requested by grin. This means that the general public
won't be able to pull the repo unless they have ssh access setup on
github.  I'd suggest switching back to https at some point and having
each person that wants to use ssh authentication change their local
repo to use ssh urls

`git config submodule.lbry.url git@github.com:lbryio/lbry.git`
2017-03-06 07:43:38 -06:00
Job Evers‐Meltzer ecec1ba5c8 Merge pull request #8 from lbryio/grin
grin's attempts at getting release.py working
2017-03-06 07:29:17 -06:00
Alex Grintsvayg 565764a629 fixing release so ppl like me can do it 2017-03-02 23:37:20 -05:00
Alex Grintsvayg 666fd5a490 renamed lbrynet to lbrynet-daemon, removed some unused code, lowercased daemon release name 2017-03-02 23:37:20 -05:00
Alex Liebowitz b81add382b Bump version: 0.9.0rc10 → 0.9.0rc11 2017-02-27 17:49:09 -05:00
Alex Liebowitz 2fc2ab0a84 update submodules 2017-02-27 17:45:09 -05:00
Alex Liebowitz d7b3b94197 Updating submodules 2017-02-27 17:26:45 -05:00
jobevers a91f987cfa specify requirements for daemon in this repo 2017-02-23 14:17:53 -06:00
jobevers 02dd08a72f allow lbrynet-daemon executable to be configured 2017-02-23 14:15:09 -06:00
jobevers 762712ed69 whitespace 2017-02-23 13:01:23 -06:00
jobevers 8a42412096 cleanup app comments 2017-02-23 12:46:25 -06:00
jobevers 6b7dca8bb1 switch from lbrynet-daemon to lbry repo 2017-02-23 12:26:31 -06:00
jobevers 0c431b0947 add tag to zip filename 2017-02-23 12:24:54 -06:00
jobevers e69e0f0c54 flailing again - trying to upload from stdin 2017-02-23 12:11:05 -06:00
jobevers 250ed2bd6a the last thing worked, now just replace json with file 2017-02-23 11:45:23 -06:00
jobevers 4ad978f3ef still flailing - what if we try to post just json 2017-02-23 11:21:46 -06:00
jobevers c05e85d0f8 still flailing - try empty name 2017-02-23 10:46:36 -06:00
jobevers 0c0b85aa7a still flailing - try lbry repo 2017-02-23 10:17:25 -06:00
jobevers 518d136d8e still flailing - try a different file 2017-02-23 09:34:30 -06:00
jobevers 318160b328 still flailing - try a random name 2017-02-23 09:16:10 -06:00
jobevers 478ca98b0e still flailing - try both requests and curl 2017-02-23 08:51:59 -06:00
jobevers 2e8c8b95c8 still flailing - use a random name 2017-02-23 08:32:28 -06:00
jobevers 6fb83f8da4 still flailing - use a simple name 2017-02-23 08:17:33 -06:00
jobevers 26c077dd79 still flailing - remove uri expansion 2017-02-22 23:14:40 -06:00
jobevers be97368123 still flailing 2017-02-22 23:05:45 -06:00
jobevers a11949608a still flailing 2017-02-22 22:53:35 -06:00
jobevers 26391cb935 flailing, lets try print some stuff 2017-02-22 18:40:39 -06:00
jobevers 4688e92aab flailing, lets try reversing the uploads 2017-02-22 17:00:19 -06:00
jobevers 498534a61e not sure what else to do, so retrying curl 2017-02-22 16:47:30 -06:00
jobevers 01e19a457b Bump version: 0.9.0rc9 → 0.9.0rc10 2017-02-22 16:14:44 -06:00
jobevers 105f234d2c update submodules 2017-02-22 15:49:14 -06:00
jobevers 18cd7608e3 revert accidental unicode testing 2017-02-22 15:49:00 -06:00
jobevers 9e7ca7c9f8 more curl debugging 2017-02-22 15:24:19 -06:00
jobevers 0c77644861 more curl debugging 2017-02-22 15:11:52 -06:00
26 changed files with 431 additions and 160 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.9.0rc9
current_version = 0.9.0rc15
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>[a-z]+)(?P<candidate>\d+))?
+10 -6
View File
@@ -1,10 +1,14 @@
app/dist
app/node_modules
node_modules
LBRY-darwin-x64
dist
lbrynet/build
lbrynet/venv
/app/dist
/app/node_modules
/build_venv
/lbry-app-venv
/lbrynet-daemon/build
/lbrynet-daemon/venv
/.idea
*.pyc
.#*
build_venv
*.pyc
+39 -38
View File
@@ -1,15 +1,12 @@
const {app, BrowserWindow, ipcMain} = require('electron');
var path = require('path');
var jayson = require('jayson');
const path = require('path');
const jayson = require('jayson');
// tree-kill has better cross-platform handling of
// killing a process. child-process.kill was unreliable
var kill = require('tree-kill');
const kill = require('tree-kill');
let client = jayson.client.http('http://localhost:5279/lbryapi');
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win
@@ -20,31 +17,26 @@ let quitting = false;
function createWindow () {
// Create the browser window.
//win = new BrowserWindow({x: 0, y: 0, width: 1440, height: 414, backgroundColor: '#155b4a'})
win = new BrowserWindow({backgroundColor: '#155b4a'})
win.maximize()
//win.webContents.openDevTools()
// and load the index.html of the app.
win.loadURL(`file://${__dirname}/dist/index.html`)
// Emitted when the window is closed.
win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null
})
};
function lauchDaemon() {
if (subpy) {
return;
}
console.log(`${__dirname}`);
executable = path.join(__dirname, 'dist', 'lbrynet-daemon');
if (process.env.LBRY_DAEMON) {
executable = process.env.LBRY_DAEMON;
} else {
executable = path.join(__dirname, 'dist', 'lbrynet-daemon');
}
console.log('Launching daemon: ' + executable)
subpy = require('child_process').spawn(executable)
// Need to handle the data event instead of attaching to
// process.stdout because the latter doesn't work. I believe on
@@ -55,8 +47,13 @@ function lauchDaemon() {
console.log('The daemon has exited. Quitting the app');
subpy = null;
if (quitting) {
// If quitting is True it means that we were expecting the daemon
// to be shutdown so we can quit right away
app.quit();
} else {
// Otherwise, this shutdown was a surprise so display a warning
// and schedule a quit
//
// TODO: maybe it would be better to restart the daemon?
win.loadURL(`file://${__dirname}/dist/warning.html`);
setTimeout(app.quit, 5000)
@@ -65,28 +62,31 @@ function lauchDaemon() {
console.log('lbrynet daemon has launched')
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', function(){
// Check if the daemon is already running. If we get
// an error its because its not running
console.log('Checking for lbrynet daemon')
client.request(
'status', [],
function (err, res) {
if (err) {
console.log('lbrynet daemon needs to be launched')
lauchDaemon();
} else {
console.log('lbrynet daemon is already running')
}
}
);
createWindow();
launchDaemonIfNotRunning();
createWindow();
});
function launchDaemonIfNotRunning() {
// Check if the daemon is already running. If we get
// an error its because its not running
console.log('Checking for lbrynet daemon');
client.request(
'status', [],
function (err, res) {
if (err) {
console.log('lbrynet daemon needs to be launched')
lauchDaemon();
} else {
console.log('lbrynet daemon is already running')
}
}
);
}
// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
@@ -96,6 +96,7 @@ app.on('window-all-closed', () => {
}
})
app.on('before-quit', (event) => {
if (subpy == null) {
return
@@ -120,7 +121,7 @@ function shutdownDaemon() {
// TODO: In this case, we didn't start the process so I'm hesitant
// to shut it down. We might want to send a stop command
// though instead of just letting it run.
console.log('Not killing lbrynet because we did not start it')
console.log('Not killing lbrynet daemon because we did not start it')
return
}
if (win) {
+107
View File
@@ -0,0 +1,107 @@
const {Menu} = require('electron');
const electron = require('electron');
const app = electron.app;
const baseTemplate = [
{
label: 'Edit',
submenu: [
{
role: 'undo',
},
{
role: 'redo',
},
{
type: 'separator',
},
{
role: 'cut',
},
{
role: 'copy',
},
{
role: 'paste',
},
]
},
{
label: 'Help',
submenu: [
{
label: 'Help',
click(item, focusedWindow) {
if (focusedWindow) {
focusedWindow.loadURL(`file://${__dirname}/../dist/index.html?help`);
}
}
}
]
}
];
const macOSAppMenuTemplate = {
label: app.getName(),
submenu: [
{
role: 'about',
},
{
type: 'separator',
},
{
role: 'hide',
},
{
role: 'hideothers',
},
{
role: 'unhide',
},
{
type: 'separator',
},
{
role: 'quit',
},
]
};
const developerMenuTemplate = {
label: 'Developer',
submenu: [
{
label: 'Reload',
accelerator: 'CmdOrCtrl+R',
click(item, focusedWindow) {
if (focusedWindow) {
focusedWindow.reload();
}
}
},
{
label: 'Toggle Developer Tools',
accelerator: process.platform == 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
click(item, focusedWindow) {
if (focusedWindow) {
focusedWindow.webContents.toggleDevTools();
}
}
},
]
};
module.exports = {
showMenubar(showDeveloperMenu) {
let template = baseTemplate.slice();
if (process.platform === 'darwin') {
template.unshift(macOSAppMenuTemplate);
}
if (showDeveloperMenu) {
template.push(developerMenuTemplate);
}
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
},
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "LBRY",
"version": "0.9.0rc9",
"version": "0.9.0rc15",
"main": "main.js",
"description": "LBRY is a fully decentralized, open-source protocol facilitating the discovery, access, and (sometimes) purchase of data.",
"author": {
+3 -3
View File
@@ -22,7 +22,7 @@ install:
- npm install
- cd ..
# create lbrynet-daemon executable
- cd lbrynet
- cd lbrynet-daemon
- ps: .\build.ps1
- cd ..
# build ui
@@ -32,7 +32,7 @@ install:
- node_modules\.bin\webpack
- ps: Copy-Item dist ..\app\ -recurse
- cd ..
- ps: Copy-Item lbrynet\dist\lbrynet-daemon.exe app\dist
- ps: Copy-Item lbrynet-daemon\dist\lbrynet-daemon.exe app\dist
build_script:
# build electron app
@@ -40,7 +40,7 @@ build_script:
# for debugging, see what was built
- python zip_daemon.py
- dir dist
- pip install PyGithub uritemplate
- pip install -r requirements.txt
- python release_on_tag.py
test: off
+49 -39
View File
@@ -1,9 +1,11 @@
#!/bin/bash
set -o xtrace
set -eu
set -euo pipefail
set -x
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$ROOT"
if [ "$(uname)" == "Darwin" ]; then
ICON="$ROOT/build/icon.icns"
else
@@ -11,9 +13,7 @@ else
fi
FULL_BUILD="${FULL_BUILD:-false}"
if [ -n "${TEAMCITY_VERSION:-}" ]; then
FULL_BUILD="true"
elif [ -n "${APPVEYOR:-}" ]; then
if [ -n "${TEAMCITY_VERSION:-}" -o -n "${APPVEYOR:-}" ]; then
FULL_BUILD="true"
fi
@@ -29,61 +29,71 @@ if [ "$FULL_BUILD" == "true" ]; then
set +u
source "$VENV/bin/activate"
set -u
pip install -U pip setuptools pyinstaller
python set_version.py
python set_build.py
pip install -r "$ROOT/requirements.txt"
python "$ROOT/set_version.py"
python "$ROOT/set_build.py"
fi
npm install
pushd $ROOT/app
npm install
popd
[ -d "$ROOT/dist" ] && rm -rf "$ROOT/dist"
mkdir -p "$ROOT/dist"
[ -d "$ROOT/app/dist" ] && rm -rf "$ROOT/app/dist"
mkdir -p "$ROOT/app/dist"
pushd "$ROOT/lbry"
pip install -r requirements.txt
# need to install our version of lbryum, not
# what is currently on master
pushd "$ROOT/lbryum"
pip install .
popd
pip install .
popd
npm install
(
cd "$ROOT/lbrynet"
pyinstaller -y lbry.onefile.spec
)
############
# UI #
############
(
cd "$ROOT/lbry-web-ui"
npm install
node_modules/.bin/node-sass --output dist/css --sourcemap=none scss/
node_modules/.bin/webpack
rm -rf "$ROOT/app/dist"
cp -r dist "$ROOT/app/dist"
cp -r dist/* "$ROOT/app/dist/"
)
mv "$ROOT/lbrynet/dist/lbrynet-daemon" "$ROOT/app/dist"
####################
# lbrynet-daemon #
####################
(
cd "$ROOT/lbrynet-daemon"
pip install -r linux_macos.txt
pyinstaller -y lbry.onefile.spec
mv dist/lbrynet-daemon "$ROOT/app/dist/"
)
python zip_daemon.py
###################
# Build the app #
###################
(
cd "$ROOT/app"
npm install
)
if [ "$FULL_BUILD" == "true" ]; then
if [ "$(uname)" == "Darwin" ]; then
security unlock-keychain -p ${KEYCHAIN_PASSWORD} osx-build.keychain
fi
node_modules/.bin/build -p never
python zip_daemon.py
# 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
# this, but it seemed better to write my own.
python release_on_tag.py
deactivate
echo 'Build and packaging complete.'
else
echo 'Build complete. Run `./node_modules/.bin/electron app` to launch the app'
fi
if [ "$FULL_BUILD" == "true" ]; then
# 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
# this, but it seemed better to write my own.
pip install PyGithub uritemplate
python release_on_tag.py
deactivate
fi
fi
+1 -1
View File
@@ -66,7 +66,7 @@ def bump(changelog, version):
continue
if CHANGELOG_ERROR_RE.search(line):
raise Exception(
'Failed to parse {}: {}'.format(filename, 'unexpected section header found'))
'Failed to parse {}: {}'.format(changelog, 'unexpected section header found'))
unreleased.append(line)
today = datetime.datetime.today()
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# https://github.com/lbryio/lbry-app/commit/4386102ba3bf8c731a075797756111d73c31a47a
# https://github.com/lbryio/lbry-app/commit/a3a376922298b94615f7514ca59988b73a522f7f
# Appveyor and Teamcity struggle with SSH urls in submodules, so we use HTTPS
# But locally, SSH urls are way better since they dont require a password
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "DIR"
git config submodule.lbry.url git@github.com:lbryio/lbry.git
git config submodule.lbryum.url git@github.com:lbryio/lbryum.git
git config submodule.lbry-web-ui.url git@github.com:lbryio/lbry-web-ui.git
+1 -1
Submodule lbry updated: 40d4fb5641...9a4230dd96.
@@ -16,9 +16,7 @@ python.exe setupmingw32.py install
cd ..\..\
Remove-Item -Recurse -Force temp
pip.exe install -r windows-requirements.txt
pip.exe install ..\lbryum
pip.exe install ..\lbry
pip.exe install pyinstaller
pip.exe install -r windows.txt
pyinstaller -y lbry.onefile.spec
Binary file not shown.
@@ -6,7 +6,7 @@ import lbryum
cwd = os.getcwd()
if os.path.basename(cwd) != 'lbrynet':
if os.path.basename(cwd) != 'lbrynet-daemon':
raise Exception('The build needs to be run from the same directory as the spec file')
repo_base = os.path.abspath(os.path.join(cwd, '..'))
File renamed without changes.
+3
View File
@@ -0,0 +1,3 @@
-r requirements.txt
miniupnpc==1.9
gmpy==1.17
@@ -1,30 +1,30 @@
pypiwin32==219
six==1.10.0
requests[security]==2.13.0
zope.interface==4.3.3
Twisted==16.6.0
appdirs==1.4.0
argparse==1.2.1
base58==0.2.2
colorama==0.3.7
dnspython==1.12.0
ecdsa==0.13
envparse==0.2.0
googlefinance==0.7
jsonrpc==1.2
jsonrpclib==0.1.7
loggly-python-handler==1.0.0
jsonschema==2.5.1
# for electron, we install lbryum, lbry using submodules
../lbryum
../lbry
pbkdf2==1.3
protobuf==3.0.0
pycrypto==2.6.1
python-bitcoinrpc==0.1
pyyaml==3.12
qrcode==5.2.2
requests==2.9.1
requests_futures==0.9.7
seccure==0.3.1.3
service_identity==16.0.0
simplejson==3.8.2
six>=1.9.0
slowaes==0.1a1
txJSON-RPC==0.5
wsgiref==0.1.2
base58==0.2.2
googlefinance==0.7
jsonschema==2.5.1
https://github.com/lbryio/lbry/raw/master/packaging/windows/libs/gmpy-1.17-cp27-none-win32.whl
zope.interface==4.3.3
+3
View File
@@ -0,0 +1,3 @@
-r requirements.txt
# on windows miniupnpc needs to be installed manually
https://github.com/lbryio/lbry/raw/master/packaging/windows/libs/gmpy-1.17-cp27-none-win32.whl
+1 -1
Submodule lbryum updated: d3bfb004e2...07882aa766.
+2 -2
View File
@@ -29,10 +29,10 @@ cmd_exists() {
set +eu
GITUSERNAME=$(git config --global --get user.name)
GITEMAIL=$(git config --global --get user.email)
if [ -z "$GITUSERNAME" ]; then
git config --global user.name "$(whoami)"
fi
GITEMAIL=$(git config --global --get user.email)
if [ -z "$GITEMAIL" ]; then
git config --global user.email "$(whoami)@lbry.io"
fi
@@ -71,7 +71,7 @@ if ! cmd_exists pip; then
fi
fi
if $LINUX && ! (pip list --format=columns | grep --quiet setuptools); then
if $LINUX && [ "$(pip list --format=columns | grep setuptools | wc -l)" -ge 1 ]; then
#$INSTALL python-setuptools
$SUDO pip install setuptools
fi
+95 -27
View File
@@ -16,25 +16,54 @@ import requests
import changelog
NO_CHANGE = ('No change since the last release. This release is simply a placeholder'
' so that LBRY and LBRY App track the same version')
TOKEN_MSG = """
Please enter your personal access token. If you don't have one
See https://github.com/lbryio/lbry-app/wiki/Release-Script#generate-a-personal-access-token
for instructions on how to generate one.
You can also set the GH_TOKEN environment variable to avoid seeing this message
in the future"""
DEFAULT_BRANCHES = {
'lbry': 'master',
'lbry-app': 'master',
'lbry-web-ui': 'development',
'lbryum': 'master'
}
# TODO: ask bumpversion for these
LBRY_PARTS = ('major', 'minor', 'patch', 'release', 'candidate')
LBRYUM_PARTS = ('major', 'minor', 'patch')
LBRYUM_MSG = """The lbryum repo has changes but you didn't specify how to bump the
version. Please enter one of {}""".format(', '.join(LBRYUM_PARTS))
def main():
parser = argparse.ArgumentParser()
parser.add_argument("lbry_part", help="part of lbry version to bump")
parser.add_argument("--lbryum_part", help="part of lbryum version to bump")
parser.add_argument("--ui-part", help="part of the ui to bump")
parser.add_argument(
"lbry_part", help="part of lbry version to bump",
choices=LBRY_PARTS
)
parser.add_argument(
"--lbryum-part", help="part of lbryum version to bump",
choices=LBRYUM_PARTS
)
parser.add_argument(
"--ui-part", help="part of the ui to bump",
choices=LBRY_PARTS
)
parser.add_argument("--branch", help="branch to use for each repo; useful for testing")
parser.add_argument("--last-release")
parser.add_argument(
"--last-release",
help=("manually set the last release version. The default is to query and parse the"
" value from the rlease page.")
)
parser.add_argument("--skip-sanity-checks", action="store_true")
parser.add_argument("--require-changelog", action="store_true")
parser.add_argument(
"--require-changelog", action="store_true",
help=("Set this flag to raise an exception if a submodules has changes without a"
" corresponding changelog entry. The default is to log a warning")
)
parser.add_argument("--skip-push", action="store_true",
help="Set to not push changes to remote repo")
args = parser.parse_args()
@@ -45,6 +74,9 @@ def main():
if not args.skip_sanity_checks:
run_sanity_checks(base, branch)
base_repo = Repo('lbry-app', args.lbry_part, os.getcwd())
base_repo.assert_new_tag_is_absent()
if args.last_release:
last_release = args.last_release
else:
@@ -53,19 +85,18 @@ def main():
last_release = data['tag_name']
logging.info('Last release: %s', last_release)
gh_token = os.environ['GH_TOKEN']
gh_token = get_gh_token()
auth = github.Github(gh_token)
github_repo = auth.get_repo('lbryio/lbry-app')
names = ['lbry', 'lbry-web-ui', 'lbryum']
repos = [Repo(name, get_part(args, name)) for name in names]
repos = {name: Repo(name, get_part(args, name)) for name in names}
# in order to see if we've had any change in the submodule, we need to checkout
# our last release, see what commit we were on, and then compare that to
# current
# our last release, see what commit we were on, and then compare that to current
base.git.checkout(last_release)
base.git.submodule('update')
for repo in repos:
for repo in repos.values():
repo.save_commit()
base.git.checkout(branch)
@@ -73,7 +104,9 @@ def main():
changelogs = {}
for repo in repos:
get_lbryum_part_if_needed(repos['lbryum'])
for repo in repos.values():
logging.info('Processing repo: %s', repo.name)
repo.checkout(args.branch)
if repo.has_changes():
@@ -94,28 +127,56 @@ def main():
# them even if there aren't any changes, but lbryum should only be
# bumped if it has changes
continue
# bumpversion will fail if there is already the tag we want in the repo
repo.assert_new_tag_is_absent()
repo.bumpversion()
release_msg = get_release_msg(changelogs, names)
for name in names:
base.git.add(name)
subprocess.check_call(['bumpversion', args.lbry_part, '--allow-dirty'])
base_repo.bumpversion()
current_tag = base.git.describe()
github_repo.create_git_release(current_tag, current_tag, release_msg, draft=True)
lbrynet_daemon_release_msg = changelogs.get('lbry', NO_CHANGE)
auth.get_repo('lbryio/lbrynet-daemon').create_git_release(
auth.get_repo('lbryio/lbry').create_git_release(
current_tag, current_tag, lbrynet_daemon_release_msg, draft=True)
if not args.skip_push:
for repo in repos:
for repo in repos.values():
repo.git.push(follow_tags=True)
base.git.push(follow_tags=True, recurse_submodules='check')
else:
logging.info('Skipping push; you will have to reset and delete tags if '
'you want to run this script again')
'you want to run this script again. Take a look at reset.sh; '
'it probably does what you want.')
def get_gh_token():
if 'GH_TOKEN' in os.environ:
gh_token = os.environ['GH_TOKEN']
else:
print TOKEN_MSG
inpt = raw_input('token: ')
gh_token = inpt.strip()
return gh_token
def get_lbryum_part_if_needed(repo):
if repo.has_changes() and not repo.part:
get_lbryum_part(repo)
def get_lbryum_part(repo):
print LBRYUM_MSG
while True:
part = raw_input('part: ')
if part in LBRYUM_PARTS:
repo.part = part
break
print 'Invalid part. Enter one of {}'.format(', '.join(LBRYUM_PARTS))
def get_branch(repo_name, override=None):
@@ -157,8 +218,7 @@ def is_behind(base, branch):
def check_bumpversion():
def requireNewVersion():
def require_new_version():
print 'Install bumpversion: pip install -U git+https://github.com/lbryio/bumpversion.git'
sys.exit(1)
@@ -166,24 +226,21 @@ def check_bumpversion():
output = subprocess.check_output(['bumpversion', '-v'], stderr=subprocess.STDOUT)
output = output.strip()
if output != 'bumpversion 0.5.4-lbry':
requireNewVersion()
require_new_version()
except (subprocess.CalledProcessError, OSError) as err:
requireNewVersion()
require_new_version()
def get_part(args, name):
if name == 'lbry-web-ui':
part = getattr(args, 'ui_part')
return part or args.lbry_part
else:
return getattr(args, name + '_part')
value = args.ui_part if name == 'lbry-web-ui' else getattr(args, name + '_part')
return value or args.lbry_part
class Repo(object):
def __init__(self, name, part):
def __init__(self, name, part, directory=None):
self.name = name
self.part = part
self.directory = os.path.join(os.getcwd(), name)
self.directory = directory or os.path.join(os.getcwd(), name)
self.git_repo = git.Repo(self.directory)
self.saved_commit = None
self._bumped = False
@@ -227,6 +284,17 @@ class Repo(object):
subprocess.check_call(['bumpversion', '--allow-dirty', self.part])
self._bumped = True
def assert_new_tag_is_absent(self):
new_tag = 'v' + self.new_version()
tags = self.git_repo.git.tag()
if new_tag in tags.split('\n'):
raise Exception('Tag {} is already present in repo {}.'.format(new_tag, self.name))
def reset(self):
branch = get_branch(self.name)
self.git_repo.git.reset(branch, hard=True)
# TODO: also delete any extra tags that might have been added
@property
def git(self):
return self.git_repo.git
+56 -21
View File
@@ -1,14 +1,11 @@
import argparse
import glob
import json
import logging
import os
import platform
import re
import subprocess
import sys
import github
import requests
import uritemplate
@@ -16,8 +13,7 @@ import uritemplate
from lbrynet.core import log_support
def main(args=None):
current_tag = None
def main():
try:
current_tag = subprocess.check_output(
['git', 'describe', '--exact-match', 'HEAD']).strip()
@@ -32,22 +28,21 @@ def main(args=None):
gh_token = os.environ['GH_TOKEN']
auth = github.Github(gh_token)
app_repo = auth.get_repo('lbryio/lbry-app')
# TODO: switch lbryio/lbrynet-daemon to lbryio/lbry
daemon_repo = auth.get_repo('lbryio/lbrynet-daemon')
daemon_repo = auth.get_repo('lbryio/lbry')
if not check_repo_has_tag(app_repo, current_tag):
log.info('Tag %s is not in repo %s', current_tag, app_repo)
# TODO: maybe this should be an error
return
app = get_app_artifact()
release = get_release(app_repo, current_tag)
upload_asset(release, app, gh_token)
daemon = get_daemon_artifact()
release = get_release(daemon_repo, current_tag)
upload_asset(release, daemon, gh_token)
app = get_app_artifact()
release = get_release(app_repo, current_tag)
upload_asset(release, app, gh_token)
def check_repo_has_tag(repo, target_tag):
tags = repo.get_tags().get_page(0)
@@ -84,30 +79,70 @@ def upload_asset(release, asset_to_upload, token):
basename = os.path.basename(asset_to_upload)
if is_asset_already_uploaded(release, basename):
return
count = 0
while count < 10:
try:
return _upload_asset(release, asset_to_upload, token, _curl_uploader)
except Exception:
log.exception('Failed to upload')
count += 1
def _upload_asset(release, asset_to_upload, token, uploader):
basename = os.path.basename(asset_to_upload)
upload_uri = uritemplate.expand(
release.upload_url, {'name': basename})
release.upload_url,
{'name': basename}
)
output = uploader(upload_uri, asset_to_upload, token)
if 'errors' in output:
raise Exception(output)
else:
log.info('Successfully uploaded to %s', output['browser_download_url'])
# requests doesn't work on windows / linux / osx.
def _requests_uploader(upload_uri, asset_to_upload, token):
log.info('Using requests to upload %s to %s', asset_to_upload, upload_uri)
with open(asset_to_upload, 'rb') as f:
response = requests.post(upload_uri, data=f, auth=('', token))
output = response.json()
return output
# curl -H "Content-Type: application/json" -X POST -d '{"username":"xyz","password":"xyz"}' http://localhost:3000/api/login
def _curl_uploader(upload_uri, asset_to_upload, token):
# using requests.post fails miserably with SSL EPIPE errors. I spent
# half a day trying to debug before deciding to switch to curl.
#
# TODO: actually set the content type
log.info('Using curl to upload %s to %s', asset_to_upload, upload_uri)
cmd = [
'curl', '-sS', '-X', 'POST', '-u', ':{}'.format(os.environ['GH_TOKEN']),
'--header', 'Content-Type:application/octet-stream',
'--data-binary', '@{}'.format(asset_to_upload), upload_uri
'curl',
'-sS',
'-X', 'POST',
'-u', ':{}'.format(os.environ['GH_TOKEN']),
'--header', 'Content-Type: application/octet-stream',
'--data-binary', '@-',
upload_uri
]
p = subprocess.Popen(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
# '-d', '{"some_key": "some_value"}',
print 'Calling curl:'
print cmd
print
with open(asset_to_upload, 'rb') as fp:
p = subprocess.Popen(cmd, stdin=fp, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
stdout, stderr = p.communicate()
print 'curl return code:', p.returncode
if stderr:
print 'stderr output from curl:'
print stderr
output = json.loads(stdout)
print 'stdout from curl:'
print stdout
if 'errors' in output:
raise Exception(output)
else:
log.info('Successfully uploaded to %s', output['browser_download_url'])
output = json.loads(stdout)
return output
def is_asset_already_uploaded(release, basename):
+6
View File
@@ -0,0 +1,6 @@
GitPython==2.1.1
PyGithub==1.32
requests[security]==2.13.0
PyInstaller==3.2.1
uritemplate==3.0.0
git+https://github.com/lbryio/bumpversion.git
Executable
+21
View File
@@ -0,0 +1,21 @@
#! /bin/bash
set -eu -o xtrace
pushd lbry
git tag -d $(git describe)
git reset --hard origin/master
popd
pushd lbry-web-ui
git tag -d $(git describe)
git reset --hard origin/development
popd
pushd lbryum
git tag -d $(git describe)
git reset --hard origin/master
popd
git tag -d $(git describe)
git reset --hard HEAD~1
-1
View File
@@ -1,6 +1,5 @@
"""Set the build version to be 'dev', 'qa', 'rc', 'release'"""
import json
import os.path
import re
import subprocess
+5 -3
View File
@@ -1,11 +1,13 @@
import os
import platform
import subprocess
import sys
import zipfile
def main():
zipfilename = 'lbrynet-daemon-{}.zip'.format(get_system_label())
tag = subprocess.check_output(['git', 'describe']).strip()
zipfilename = 'lbrynet-daemon-{}-{}.zip'.format(tag, get_system_label())
full_filename = os.path.join('dist', zipfilename)
executable = 'lbrynet-daemon'
if platform.system() == 'Windows':
@@ -17,9 +19,9 @@ def main():
def get_system_label():
system = platform.system()
if system == 'Darwin':
return 'macOS'
return 'macos'
else:
return system
return system.lower()
if __name__ == '__main__':