def get_version(self, fail_on_missing=True): if not self.version: if not self.latest_version: self.get_latest_version(fail_on_missing=fail_on_missing) if self.bundle_obj.version_map_exists: # Cases # 1. version from bundle name = self.name if self.bundle_obj.version_map.has_key(name): self.version = self.bundle_obj.version_map[name] # 2. If a package is not listed in bundle, print warning and skip else: print "* Package %s not available in bundle (%s) ... skipping" % ( self.name, self.bundle_obj.bundle_name) return "" #sys.exit(1) # 3. If a package is listed as package="", select the latest version if self.version == "": self.version = self.latest_version # 4. If version has a release of x-0, select x elif re.compile('([\d\.]*)-0').search(self.version): # Weird comma is because groups() returns tuples self.version, = re.compile('([\d\.]*)-0').search( self.version).groups(1) # 5. If version doesn't have a release (signified by a dash), get the latest release of that version elif not re.compile('[\d\.]*-').search(self.version): my_version = utils.get_latest_ver( self.package_fullpath, version=self.version, fail_on_missing=fail_on_missing) if not my_version: print "WARNING: no packages available for version: %s" % self.version self.version = my_version # If we don't have a valid version or the path doesn't exist, fail if fail_on_missing is set if (not self.version or not os.path.exists(self.package_fullpath + os.sep + self.version)) and fail_on_missing: print "Bundle selection: trying to use %s/%s but this path does not exist!" % ( self.package_fullpath, self.version) sys.exit(1) else: self.version = self.latest_version return self.version
def get_version(self, fail_on_missing=True): if not self.version: if not self.latest_version: self.get_latest_version(fail_on_missing=fail_on_missing) if self.bundle_obj.version_map_exists: # Cases # 1. version from bundle name = self.name if self.bundle_obj.version_map.has_key(name): self.version = self.bundle_obj.version_map[name] # 2. If a package is not listed in bundle, print warning and skip else: print "* Package %s not available in bundle (%s) ... skipping" % (self.name, self.bundle_obj.bundle_name) return "" #sys.exit(1) # 3. If a package is listed as package="", select the latest version if self.version == "": self.version = self.latest_version # 4. If version has a release of x-0, select x elif re.compile('([\d\.]*)-0').search(self.version): # Weird comma is because groups() returns tuples self.version, = re.compile('([\d\.]*)-0').search(self.version).groups(1) # 5. If version doesn't have a release (signified by a dash), get the latest release of that version elif not re.compile('[\d\.]*-').search(self.version): my_version = utils.get_latest_ver(self.package_fullpath, version=self.version, fail_on_missing=fail_on_missing) if not my_version: print "WARNING: no packages available for version: %s" % self.version self.version = my_version # If we don't have a valid version or the path doesn't exist, fail if fail_on_missing is set if (not self.version or not os.path.exists(self.package_fullpath + os.sep + self.version)) and fail_on_missing: print "Bundle selection: trying to use %s/%s but this path does not exist!" % (self.package_fullpath, self.version) sys.exit(1) else: self.version = self.latest_version return self.version
#!/usr/bin/env python import sys sys.path += [".."] import utils print utils.get_latest_ver('../../packaging/packages/noarch/gtksourceview-sharp-2.0', version='0.10') print utils.get_latest_ver('../../packaging/packages/noarch/gtksourceview-sharp-2.0') print utils.get_latest_ver('../../packaging/packages/noarch/gtksourceview-sharp-2.0', version='0.9')
print "Writing %s to index page" % installer_map['dir_name'] topdir = 'archive' _version = version if installer_map['dir_name'] == "md-macos-10": topdir = 'monodevelop' _version = md_version my_dir = os.path.join(output_dir, topdir, _version, installer_map['dir_name']) # Skip if the installer doesn't exist for this release if not os.path.exists(my_dir): print "Directory '%s' doens't exist" % my_dir continue revision = utils.get_latest_ver(my_dir) installer_dir = my_dir + os.sep + revision ref_dir = os.path.join("..",installer_map['dir_name'], revision) ref_dir2 = os.path.join("..", topdir, _version, installer_map['dir_name'], revision) #tab = 20 #print "installer_dir = ".rjust(tab) + installer_dir #print "revision = ".rjust(tab) + revision #print "ref_dir = ".rjust(tab) + ref_dir #print "ref_dir2 = ".rjust(tab) + ref_dir2 filename = os.path.basename(glob.glob(installer_dir + os.sep + '*.%s' % installer_map['ext']).pop()) sum_filename = os.path.basename(glob.glob(installer_dir + os.sep + '*.md5').pop()) #print "filename = ".rjust(tab) + filename