Permalink
Browse files

helper: commands: update: save the release type to download in the bu…

…ilt versions

Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
  • Loading branch information...
XaF committed Apr 29, 2018
1 parent eb1b117 commit 528f89867726bd928a11068d33805a1ed07a2d39
Showing with 34 additions and 12 deletions.
  1. +9 −12 helper/commands/update.py
  2. +1 −0 helper/version.py
  3. +24 −0 version.py
@@ -31,7 +31,6 @@
import re
import requests
import stat
import struct
import subprocess
import tempfile
@@ -43,6 +42,7 @@
)
from helper.version import (
__version__,
__release_type__,
)
LOGGER = logging.getLogger(__name__)
@@ -143,6 +143,10 @@ def run(self, dry_run, yes, system, service, service_host, service_port,
ret = {}
if release_type or version:
if not __release_type__:
print('{}')
return
if release_type:
resp = requests.get(
'https://api.github.com/repos/XaF/TraktForVLC/releases')
@@ -163,18 +167,11 @@ def run(self, dry_run, yes, system, service, service_host, service_port,
search_level = releases_level[release_type]
# Determine the format of the asset we will check to download
system = platform.system().lower()
if system == 'darwin':
system = 'osx'
elif system == 'windows':
arch = struct.calcsize('P') * 8
if arch == 32:
system = '{}_x86'.format(system)
elif arch == 64:
system = '{}_x64'.format(system)
system = '{}.exe'.format(system)
asset_suffix = __release_type__
if platform.system() == 'Windows':
asset_suffix = '{}.exe'.format(asset_suffix)
asset_re = re.compile('^TraktForVLC_(?P<version>.*)_{}$'.format(
re.escape(system)))
re.escape(asset_suffix)))
# Then try and go through the available releases on GitHub to check
# for the most recent one fitting our parameters
@@ -22,6 +22,7 @@
__version__ = '0.0.0a0.dev0'
__release_name__ = ''
__release_type__ = ''
__build_date__ = ''
__build_system__ = ''
__build_system_release__ = ''
@@ -35,6 +35,7 @@
import platform
import re
import shutil
import struct
import subprocess
import tempfile
import time
@@ -505,6 +506,24 @@ def build_system_release():
return ''
def release_type():
if reset:
return ''
system = platform.system().lower()
if system == 'darwin':
system = 'osx'
elif system == 'windows':
arch = struct.calcsize('P') * 8
if arch == 32:
system = '{}_x86'.format(system)
elif arch == 64:
system = '{}_x64'.format(system)
if os.getenv('BIN_SUFFIX'):
system = '{}_{}'.format(system, os.environ['BIN_SUFFIX'])
return system
rules = [
{
'files': [
@@ -550,6 +569,11 @@ def build_system_release():
re.MULTILINE),
"\g<1>'{}'".format(build_system_release()),
),
(
re.compile("^(__release_type__ = )'.*'$",
re.MULTILINE),
"\g<1>'{}'".format(release_type()),
),
],
},
]

0 comments on commit 528f898

Please sign in to comment.