Commits

Jed Brown committed d9774d5

config download: track whether the user provided a URL

If the user passes --download-PKGNAME=URL-of-tarball, we use it
exclusively. If not, we prefer to get the source via Git, and fall back
to downloading tarballs from the urls in PKGNAME.py.

  • Participants
  • Parent commits c70504c

Comments (0)

Files changed (1)

config/BuildSystem/config/package.py

     self.gitcommit        = None # Git commit to use for downloads (used in preference to tarball downloads)
     self.giturls          = []   # list of Git repository URLs to be used for downloads
     self.download         = []   # list of URLs where repository or tarballs may be found
+    self.downloadURLSetByUser = False # user overrode package file by providing download location
     self.deps             = []   # other packages whose dlib or include we depend on, usually we also use self.framework.require()
     self.defaultLanguage  = 'C'  # The language in which to run tests
     self.liblist          = [[]] # list of libraries we wish to check for (override with your own generateLibList())
     downloadPackageVal = self.framework.argDB['download-'+self.downloadname.lower()]
     if requireDownload and isinstance(downloadPackageVal, str):
       self.download = [downloadPackageVal]
+      self.downloadURLSetByUser = True
       downloadPackage = 1
     elif downloadPackageVal == 1 and requireDownload:
       downloadPackage = 1
         download_urls.append(url.replace('http://','ftp://'))
     # now attempt to download each url until any one succeeds.
     err =''
-    if hasattr(self.sourceControl, 'git') and self.gitcommit and self.gitPreReqCheck():
+    if not self.downloadURLSetByUser and hasattr(self.sourceControl, 'git') and self.gitcommit and self.gitPreReqCheck():
       for giturl in self.giturls: # First try to fetch using Git
         try:
           gitrepo = os.path.join(self.externalPackagesDir, self.downloadname)