Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: sitescripts/extensions/bin/updateDownloadLinks.py

Issue 10669003: Link to remote downloads server rather than a local downloads directory (Closed)
Patch Set: Created May 22, 2013, 2:33 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « .sitescripts.example ('k') | sitescripts/extensions/utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/extensions/bin/updateDownloadLinks.py
===================================================================
--- a/sitescripts/extensions/bin/updateDownloadLinks.py
+++ b/sitescripts/extensions/bin/updateDownloadLinks.py
@@ -97,26 +97,27 @@ def getOperaDownloadLink(galleryID):
else:
return (None, None)
def getLocalLink(repo):
"""
gets the link for the newest download of an add-on in the local downloads
repository
"""
- dir = repo.downloadsDirectory
url = repo.downloadsURL
highestURL = None
highestVersion = None
prefix = os.path.basename(repo.repository) + '-'
suffix = repo.packageSuffix
- # go through the downloads directory looking for downloads matching this extension
- for fileName in os.listdir(dir):
+ # go through the downloads repository looking for downloads matching this extension
+ command = ['hg', 'locate', '-R', repo.downloadsRepo, '-r', 'default']
+ result, dummy = subprocess.Popen(command, stdout=subprocess.PIPE).communicate()
+ for fileName in result.splitlines():
if fileName.startswith(prefix) and fileName.endswith(suffix):
version = fileName[len(prefix):len(fileName) - len(suffix)]
if highestVersion == None or compareVersions(version, highestVersion) > 0:
highestURL = urlparse.urljoin(url, fileName)
highestVersion = version
return (highestURL, highestVersion)
def getDownloadLink(repo):
@@ -232,20 +233,16 @@ def writeUpdateManifest(links):
template = get_template(get_config().get('extensions', '%sUpdateManifest' % repoType))
template.stream({'extensions': extensions[repoType]}).dump(manifestPath)
def updateLinks():
"""
writes the current extension download links to a file
"""
- # Update downloads directory first
- downloadsRepository = get_config().get('extensions', 'downloadsDirectory')
- subprocess.Popen(['hg', '-R', downloadsRepository, 'pull', '-u'], stdout=subprocess.PIPE).communicate()
-
# Now get download links and save them to file
result = SafeConfigParser()
getDownloadLinks(result)
file = open(get_config().get('extensions', 'downloadLinksFile'), 'wb')
result.write(file)
file.close()
writeUpdateManifest(result)
« no previous file with comments | « .sitescripts.example ('k') | sitescripts/extensions/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld