Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Bug 1559983 - Move balrogscript to python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanLorenzo committed Jun 18, 2019
1 parent f2ca15e commit fe4b2d8
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 31 deletions.
20 changes: 15 additions & 5 deletions .travis.yml
@@ -1,12 +1,22 @@
sudo: false

language: python
python:
- "2.7"

matrix:
fast_finish: true
include:

- python: 3.6
env: TOXENV=py36

- python: 3.7
# from https://github.com/travis-ci/travis-ci/issues/9815#issuecomment-401756442
dist: xenial
sudo: true
env: TOXENV=py37

install:
- travis_retry pip install tox
script:
- tox -e py27
after_success:
- tox -e py27-coveralls
- tox -e "$TOXENV"
- if [[ $TOXENV == 'py37' ]] ; then tox -e coveralls; else echo "No coverage to do"; fi
4 changes: 2 additions & 2 deletions balrogscript/script.py
Expand Up @@ -143,7 +143,7 @@ def submit_toplevel(task, config, auth0_secrets):
version, build_number = v.split("build")
partials[version] = {"buildNumber": build_number}

suffixes = task['payload'].get('update_line', {}).keys() or ['']
suffixes = list(task['payload'].get('update_line', {}).keys()) or ['']

for suffix in suffixes:
creator = create_creator(
Expand Down Expand Up @@ -186,7 +186,7 @@ def submit_toplevel(task, config, auth0_secrets):

# usage {{{1
def usage():
print >> sys.stderr, "Usage: {} CONFIG_FILE".format(sys.argv[0])
print("Usage: {} CONFIG_FILE".format(sys.argv[0]), file=sys.stderr)
sys.exit(2)


Expand Down
6 changes: 3 additions & 3 deletions balrogscript/submitter/cli.py
Expand Up @@ -81,7 +81,7 @@ def _getFileUrls(self, productName, version, buildNumber, updateChannels,

for channel in uniqueChannels:
data["fileUrls"][channel]["partials"] = {}
for previousVersion, previousInfo in partialUpdates.iteritems():
for previousVersion, previousInfo in partialUpdates.items():
from_ = get_release_blob_name(productName, previousVersion,
previousInfo["buildNumber"],
self.from_suffix)
Expand Down Expand Up @@ -255,7 +255,7 @@ def update_dated():
all(p in current_data.get("partials", [])
for p in data.get("partials", [])))
if skip_submission:
log.warn("Dated data didn't change, skipping update")
log.warning("Dated data didn't change, skipping update")
return
# explicitly pass data version
api.update_build(
Expand All @@ -282,7 +282,7 @@ def update_latest():
latest_data, latest_data_version = latest.get_data()
source_data, _ = api.get_data()
if source_data == latest_data:
log.warn("Latest data didn't change, skipping update")
log.warning("Latest data didn't change, skipping update")
return
latest.update_build(
product=productName,
Expand Down
3 changes: 2 additions & 1 deletion balrogscript/submitter/release.py
@@ -1,5 +1,6 @@
import re
from urlparse import urlunsplit

from urllib.parse import urlunsplit


def getProductDetails(product, appVersion):
Expand Down
2 changes: 1 addition & 1 deletion balrogscript/submitter/util.py
Expand Up @@ -3,7 +3,7 @@

# From https://stackoverflow.com/questions/3232943/update-value-of-a-nested-dictionary-of-varying-depth
def recursive_update(d, u):
for k, v in u.iteritems():
for k, v in u.items():
if isinstance(v, collections.Mapping):
r = recursive_update(d.get(k, {}), v)
d[k] = r
Expand Down
8 changes: 4 additions & 4 deletions balrogscript/test/test_submitter_updates.py
Expand Up @@ -8,20 +8,20 @@ class TestCandidatesDir(unittest.TestCase):
def test_base(self):
expected = "/pub/bbb/candidates/1.0-candidates/build2/"
got = makeCandidatesDir('bbb', '1.0', 2)
self.assertEquals(expected, got)
self.assertEqual(expected, got)

def test_fennec(self):
expected = "/pub/mobile/candidates/15.1-candidates/build3/"
got = makeCandidatesDir('fennec', '15.1', 3)
self.assertEquals(expected, got)
self.assertEqual(expected, got)

def test_remote(self):
expected = "http://foo.bar/pub/bbb/candidates/1.0-candidates/build5/"
got = makeCandidatesDir('bbb', '1.0', 5, protocol="http",
server='foo.bar')
self.assertEquals(expected, got)
self.assertEqual(expected, got)

def test_ftp_root(self):
expected = "pub/bbb/candidates/1.0-candidates/build5/"
got = makeCandidatesDir('bbb', '1.0', 5, ftp_root="pub/")
self.assertEquals(expected, got)
self.assertEqual(expected, got)
4 changes: 0 additions & 4 deletions requirements-dev.txt
@@ -1,16 +1,12 @@
arrow
balrogclient>=0.2.0
cryptography
enum34
# Pinning functools b/c pip returns a bogus 3.2.3.post2
functools32==3.2.3-2
idna
ipaddress
jsonschema
mar
pyasn1
python-dateutil
requests
six
# Pinning towncrier b/c towncrier 18.6.0 drops py2 support
towncrier==18.5.0
15 changes: 4 additions & 11 deletions tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist = py27
envlist = py36, py37

[testenv]
setenv =
Expand All @@ -12,22 +12,15 @@ passenv =
TRAVIS_BRANCH

deps =
-rrequirements-dev.txt
coverage>=4.2
cryptography
enum34
flake8
functools32
idna
ipaddress
lockfile
mar
minimock
mock
pyasn1
pytest
pytest-cov
pytest-mock
six

whitelist_externals = bash

Expand All @@ -36,10 +29,10 @@ commands=
coverage html
flake8

[testenv:py27-coveralls]
[testenv:coveralls]
deps=
python-coveralls
coverage>=4.2
coverage
commands=
coveralls

Expand Down

0 comments on commit fe4b2d8

Please sign in to comment.