def get_publishable_paths(self, names, excluded_names=None): """Return a list of paths of publishable objects. """ # TODO: support excludeable items try: exclude_cre = self.get_exclude_cre() include_cre = self.get_include_cre() except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad include and/or exclude") paths = [] for name in names: path = os.path.join(self.path, name) if include_cre.match(path) and not exclude_cre.match(path): paths.append(path) for root, dirnames, filenames in special_links_walk(path): for dirname in dirnames: path2 = os.path.join(root, dirname) if include_cre.match( path2) and not exclude_cre.match(path2): paths.append(path2) for filename in filenames: path2 = os.path.join(root, filename) if include_cre.match( path2) and not exclude_cre.match(path2): paths.append(path2) return paths
platforms_pattern = args.pop(0) elif arg in ["-u", "--repositoryUrl"] and args: repo_url = args.pop(0) elif arg in ["--debug"]: globls.debug = True elif arg in ["--verbose"]: globls.verbose = True else: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") try: if repo_url: sources = repo_url else: domain = Domain(domain_home) sources = domain.get_sources() repo = Repository(sources) package_map = {} package_urls = repo.list() for url in repo.list(): filename = os.path.basename(url) if not filename.endswith(".ssm"): continue
print_usage() sys.exit(0) elif arg in ["-d", "--domainHome"] and args: domain_home = args.pop(0) elif arg in ["--debug"]: globls.debug = True else: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") if domain_home == None: utils.print_exit("error: bad/missing argument(s)") try: domain = Domain(domain_home) if not domain.is_compatible(): utils.print_exit(MSG_INCOMPATIBLE_DOMAIN) if not domain.is_frozen(): utils.print_exit("warning: domain not frozen") domain.unfreeze() except SystemExit: raise except utils.SSMExitException, detail: utils.print_exit(detail)
globls.force = True elif arg in ["--verbose"]: globls.verbose = True elif arg in ["-y", "--yes"]: globls.auto_yes = True elif len(args) == 1: src_domain_home = arg dst_domain_home = args.pop(0) else: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") if src_domain_home == dst_domain_home == None: utils.print_exit("error: missing argument(s)") if not clone_domain and not clone_installed and not clone_published: clone_domain = clone_installed = clone_published = True try: src_domain = Domain(src_domain_home) dst_domain = Domain(dst_domain_home) alt_src_domain = alt_src_domain_home and Domain(alt_src_domain_home) if not src_domain.is_compatible(): utils.print_exit(MSG_INCOMPATIBLE_DOMAIN) if alt_src_domain and not alt_src_domain.is_compatible(): utils.print_exit(MSG_INCOMPATIBLE_DOMAIN)
elif arg in ["--debug"]: globls.debug = True elif arg in ["--force"]: globls.force = True elif arg in ["--verbose"]: globls.verbose = True #elif arg in ["-y", "--yes"]: #globls.auto_yes = True else: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") if not package_name: utils.print_exit("error: missing package name") try: domain = Domain(domain_home) if not domain.is_compatible(): utils.print_exit(MSG_INCOMPATIBLE_DOMAIN) pkg = Package(domain, package_name) if domain.is_published(package_name): utils.print_exit("error: package is published") if not pkg.exists() and not domain.is_installed(package_name): utils.print_exit("error: package is not installed") pkg.uninstall() except SystemExit:
elif arg in ["--debug"]: globls.debug = True elif arg in ["--force"]: globls.force = True elif arg in ["--verbose"]: globls.verbose = True #elif arg in ["-y", "--yes"]: #globls.auto_yes = True else: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") # TODO: this does not check properly if not domain_home: utils.print_exit("error: cannot do a create over an existing domain") try: domain = Domain(domain_home) domain.create(label, repo_source) except SystemExit: raise except utils.SSMExitException, detail: utils.print_exit(detail) except: if globls.debug: traceback.print_exc()
elif arg in ["-d", "--domainHome"] and args: domain_home = args.pop(0) elif arg in ["--debug"]: globls.debug = True elif arg in ["--verbose"]: globls.verbose = True else: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") try: domain = Domain(domain_home) if not domain.is_compatible(): utils.print_exit(MSG_INCOMPATIBLE_DOMAIN) paths = [[domain.path, 0]] paths.extend(get_all_subdomains(domain.path, 1)) for path, level in paths: print "%s%s" % (" " * level, path) except SystemExit: raise except utils.SSMExitException, detail: utils.print_exit(detail) except: if globls.debug:
find_type = args.pop(0) elif arg in ["--debug"]: globls.debug = True else: term = arg if args: base_paths = args[:] args = [] break except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") if term == None: utils.print_exit("error: bad/missing argument(s)") if base_paths == [""]: utils.print_exit("error: no place to search") #print "find_type (%s)" % (find_type,) #print "term (%s)" % (term,) #print "base_paths (%s)" % (base_paths,) if find_type == "package": if not ("*" in term or "?" in term or "_" in term): term += "_*" try:
elif arg in ["--debug"]: globls.debug = True elif arg in ["--force"]: globls.force = True elif arg in ["--verbose"]: globls.verbose = True elif arg in ["-y", "--yes"]: globls.auto_yes = True else: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") try: domain = Domain(domain_home) if not domain.is_compatible(): utils.print_exit(MSG_INCOMPATIBLE_DOMAIN) if label != None: domain.set_label(label) if sources != None: domain.set_sources(sources) if subdomains_filename != None: if subdomains_filename == "-": f = sys.stdin elif subdomains_filename == "--": # open editor pass
elif arg in ["--debug"]: globls.debug = True elif arg in ["--force"]: globls.force = True elif arg in ["--verbose"]: globls.verbose = True elif arg in ["-y", "--yes"]: globls.auto_yes = True else: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") if not domain_home: utils.print_exit("error: missing a domain home") if not subscribe_type: utils.print_exit("error: must specify --user or --system") try: login_path, profile_path = utils.get_profile_paths(subscribe_type) ssmd_dir_path, ssmd_login_path, ssmd_profile_path = utils.get_ssmd_profile_paths( subscribe_type) # update profile/login files if SSM_PROFILE_STAMP_END not in utils.loads(login_path): open(login_path, "a+").write(SSM_LOGIN_TEMPLATE.format(ssmd_login_path))
usage: ssm version [options] ssm version -h|--help Show the SSM version. Miscellaneous options: --debug Enable debugging.""") if __name__ == "__main__": try: args = sys.argv[1:] while args: arg = args.pop(0) if arg in ["-h", "--help"]: print_usage() sys.exit(0) elif arg in ["--debug"]: globls.debug = True elif arg: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") print VERSION_STRING
elif arg in ["--debug"]: globls.debug = True elif arg in ["--force"]: globls.force = True elif arg in ["--verbose"]: globls.verbose = True #elif arg in ["-y", "--yes"]: #globls.auto_yes = True else: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") if filename: if filename.endswith(".ssm"): sources = [os.path.realpath(os.path.dirname(filename))] package_name = os.path.basename(filename)[:-4] else: utils.print_exit("error: bad filename") if not package_name: utils.print_exit("error: missing package name") try: domain = Domain(domain_home) if not domain.is_compatible(): utils.print_exit(MSG_INCOMPATIBLE_DOMAIN)
print_usage() sys.exit(0) elif arg in ["-d", "--domainHome"] and args: domain_home = args.pop(0) elif arg in ["--debug"]: globls.debug = True else: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") if domain_home == None: utils.print_exit("error: bad/missing argument(s)") try: domain = Domain(domain_home) if not domain.is_compatible(): utils.print_exit(MSG_INCOMPATIBLE_DOMAIN) if domain.is_frozen(): utils.print_exit("warning: domain is already frozen") else: try: domain.freeze() except:
elif arg == "-O" and args: output_type = "format_with_headings" format_fields = args.pop(0).split(",") elif arg in ["-p", "--packageName"] and args: package_name_pattern = args.pop(0) elif arg in ["--debug"]: globls.debug = True else: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") if domain_home_pattern == None: domain_homes = [Domain().path] else: domain_homes = sorted(glob.glob(domain_home_pattern)) if output_type == "format": headings = None fmt = "%s" else: if output_type == "format_with_headings": pass elif output_type == "long": format_fields = [ "state", "install_timestamp", "publish_platform", "name",
elif arg in ["--debug"]: globls.debug = True elif arg in ["--force"]: globls.force = True elif arg in ["--verbose"]: globls.verbose = True elif arg in ["-y", "--yes"]: globls.auto_yes = True else: raise Exception() except SystemExit: raise except: if globls.debug: traceback.print_exc() utils.print_exit("error: bad/missing argument(s)") if not package_name: utils.print_exit("error: missing package name") try: domain = Domain(domain_home) if not domain.is_domain(): utils.print_exit("error: cannot find domain (%s)" % domain_home) if not domain.is_compatible(): utils.print_exit(MSG_INCOMPATIBLE_DOMAIN) if publish_home == None: publish_home = domain_home publish_domain = Domain(publish_home) if not publish_domain.is_domain(): utils.print_exit("error: cannot find domain (%s)" % publish_domain)