Skip to content

Commit

Permalink
Merge pull request #261 from RyanJarv/fix/darwin-upload
Browse files Browse the repository at this point in the history
Fix darwin dmg name in upload script
  • Loading branch information
RyanJarv authored Jul 17, 2018
2 parents b08cf47 + 4e5579f commit 3d4a3c8
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 7 deletions.
15 changes: 15 additions & 0 deletions script/test/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,20 @@ def test_returns_none_on_new_draft(self):
upload.get_draft(self.repo, 'new')
self.assertEquals(upload.get_draft(self.repo, 'test'), None)

class TestYieldBravePackages(unittest.TestCase):
def setUp(self):
self.yield_pkgs_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'test_yield_pkgs')

def test_only_returns_dev_darwin_package(self):
upload.PLATFORM = 'darwin'
pkgs = list(upload.yield_brave_packages(os.path.join(self.yield_pkgs_dir, upload.PLATFORM), 'dev', '0.50.8'))
self.assertEquals(pkgs, ['Brave-Browser-Dev.dmg'])

def test_only_returns_dev_linux_packages(self):
upload.PLATFORM = 'linux'
pkgs = list(upload.yield_brave_packages(os.path.join(self.yield_pkgs_dir, upload.PLATFORM), 'dev', '0.50.8'))
self.assertEquals(sorted(pkgs), sorted(['brave-browser-dev-0.50.8-1.x86_64.rpm', 'brave-browser-dev_0.50.8_amd64.deb']))


if __name__ == '__main__':
print unittest.main()
1 change: 1 addition & 0 deletions script/test/test_yield_pkgs/darwin/Brave-Browser-Dev.dmg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev darwin dmg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
release darwin dmg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mock linux x64 rpm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mock linux x64 rpm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mock linux x64 rpm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mock linux x64 rpm
14 changes: 7 additions & 7 deletions script/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ def main():
chromedriver = get_zip_name('chromedriver', get_chromedriver_version())
upload_brave(repo, release, os.path.join(dist_dir(), chromedriver), force=args.force)

pkgs = yield_brave_packages(output_dir(), release_channel(), get_raw_version())

if PLATFORM == 'darwin':
for pkg in yield_brave_packages():
for pkg in pkgs:
upload_brave(repo, release, os.path.join(output_dir(), pkg), force=args.force)
elif PLATFORM == 'win32':
if get_target_arch() == 'x64':
Expand All @@ -68,7 +70,7 @@ def main():
'brave_installer.exe'), 'brave_installer-ia32.exe', force=args.force)
else:
if get_target_arch() == 'x64':
for pkg in yield_brave_packages():
for pkg in pkgs:
upload_brave(repo, release, os.path.join(output_dir(), pkg), force=args.force)
else:
upload_brave(repo, release, os.path.join(output_dir(), 'brave-i386.rpm'), force=args.force)
Expand All @@ -86,14 +88,12 @@ def main():
print('[INFO] Finished upload')


def yield_brave_packages():
def yield_brave_packages(dir, channel, version):
# NOTE: mbacchi - before official release this must handle stable release channel which is ""
channel = release_channel()
version = get_raw_version()
for _, _, files in os.walk(output_dir()):
for _, _, files in os.walk(dir):
for file in files:
if PLATFORM == 'darwin':
if re.match(r'Brave-Browser-' + get_channel_display_name(channel) + r'.*\.dmg$'):
if re.match(r'Brave-Browser-' + channel.capitalize() + r'.*\.dmg$', file):
yield file
elif PLATFORM == 'linux':
if re.match(r'brave-browser-' + channel + '_' + version + r'.*\.deb$', file) \
Expand Down

0 comments on commit 3d4a3c8

Please sign in to comment.