[gettor/master] Changes for production in github uploader

commit c66101e83598eda5b2d12841b7520a6f64264810 Author: ilv <ilv@users.noreply.github.com> Date: Mon Feb 15 21:00:36 2016 -0300 Changes for production in github uploader --- gettor/utils.py | 12 ++++++------ upload/bundles2github.py | 31 +++++++++++++------------------ 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/gettor/utils.py b/gettor/utils.py index c4f43c7..2780564 100644 --- a/gettor/utils.py +++ b/gettor/utils.py @@ -20,9 +20,9 @@ import hashlib LOGGING_FORMAT = "[%(levelname)s] %(asctime)s; %(message)s" DATE_FORMAT = "%Y-%m-%d" # %H:%M:%S -windows_regex = '^torbrowser-install-\d\.\d\.\d_\w\w(-\w\w)?\.exe$' -linux_regex = '^tor-browser-linux\d\d-\d\.\d\.\d_(\w\w)(-\w\w)?\.tar\.xz$' -osx_regex = '^TorBrowser-\d\.\d\.\d-osx\d\d_(\w\w)(-\w\w)?\.dmg$' +windows_regex = '^torbrowser-install-\d\.\d(\.\d)?_(\w\w)(-\w\w)?\.exe$' +linux_regex = '^tor-browser-linux(\d\d)-\d\.\d(\.\d)?_(\w\w)(-\w\w)?\.tar\.xz$' +osx_regex = '^TorBrowser-\d\.\d(\.\d)?-osx\d\d_(\w\w)(-\w\w)?\.dmg$' def get_logging_format(): @@ -70,11 +70,11 @@ def get_bundle_info(filename, osys=None): m_osx = re.search(osx_regex, filename) if m_windows: - return 'windows', '32/64', m_windows.group(1) + return 'windows', '32/64', m_windows.group(2) elif m_linux: - return 'linux', m_linux.group(1), m_linux.group(2) + return 'linux', m_linux.group(1), m_linux.group(3) elif m_osx: - return 'osx', m_osx.group(1), m_osx.group(2) + return 'osx', '64', m_osx.group(2) else: raise ValueError("Invalid bundle format %s" % file) diff --git a/upload/bundles2github.py b/upload/bundles2github.py index d081ddd..e670f85 100644 --- a/upload/bundles2github.py +++ b/upload/bundles2github.py @@ -67,33 +67,28 @@ if __name__ == '__main__': help='Create links file with files already uploaded.' ) - parser.add_argument( - '-v', '--version', default=None, - help='Version of Tor Browser.' - ) - args = parser.parse_args() config = ConfigParser.ConfigParser() - config.read('github-local.cfg') + config.read('github.cfg') - # this script should be called after fetching the latest Tor Browser, - # and specifying the latest version - if args.version: - version = args.version - else: - tbb_version_config = ConfigParser.ConfigParser() - tbb_version_config.read('latest_torbrowser.cfg') - version = tbb_version_config.get('version', 'current') + tbb_version_path = config.get('general', 'version_cfg_path') + + tbb_version_config = ConfigParser.ConfigParser() + tbb_version_config.read(tbb_version_path) + version = tbb_version_config.get('version', 'current') # the token allow us to run this script without GitHub user/pass github_access_token = config.get('app', 'access_token') # path to the fingerprint that signed the packages - tb_key = os.path.abspath('tbb-key-torbrowserteam.asc') + tb_key = config.get('general', 'tbb_key_path') # path to the latest version of Tor Browser - tb_path = os.path.abspath('latest') + tb_path = config.get('general', 'latest_path') + + # path to gettor code configuration + core_path = config.get('general', 'core_path') # user and repository where we upload Tor Browser github_user = config.get('app', 'user') @@ -139,13 +134,13 @@ if __name__ == '__main__': release.edit(draft=False) # Create the links file for this release - core = gettor.core.Core(os.path.abspath('../core.cfg')) + core = gettor.core.Core(core_path) # Erase old links if any and create a new empty one core.create_links_file('GitHub', readable_fp) print("Creating links file") - for asset in release.assets: + for asset in release.assets(): url = asset.browser_download_url if url.endswith('.asc'): continue
participants (1)
-
ilv@torproject.org