def get_eggs(src_dirs): """Creates a list of dictionaries with eggs to install. """ for directory in src_dirs: if os.path.isdir(directory): for file in os.listdir(directory): if os.path.isfile(os.path.join(directory, file)): try: content = _open(os.path.dirname(file), os.path.join(directory, file), []) except MissingSectionHeaderError: continue except TypeError: try: # this is for compatibility with zc.buildout 1.4.0 content = _open(os.path.dirname(file), os.path.join(directory, file), [], {}, {}, set()) except MissingSectionHeaderError: continue if content.has_key('eggnest'): yield content['eggnest'] else: log.warning("%s is not a directory." % directory)
def _open(base, filename, seen, dl_options, override, downloaded): # For now need to support 1.4.3 and 1.6.3... from zc.buildout.buildout import _open try: return _open(base, filename, seen, dl_options, override, downloaded) except TypeError: return _open(base, filename, seen, dl_options, override)
def load(self, path, optional=False): config_file = path if not path.startswith("/"): config_file = sibpath(self.name, path) if not os.path.exists(config_file): if not optional: raise UserError("Could not load '%s'" % path) return self.log.debug("Loading '%s' from stack" % config_file) override = {} _update(self.data, _open(os.path.dirname(config_file), config_file, [], self.data['buildout'].copy(), override, set()))
def get_eggs(src_dirs): """Creates a list of dictionaries with eggs to install. """ for directory in src_dirs: if os.path.isdir(directory): for file in os.listdir(directory): if os.path.isfile(os.path.join(directory, file)): try: content = _open(os.path.dirname(file),os.path.join(directory, file),[]) except MissingSectionHeaderError: continue except TypeError: try: # this is for compatibility with zc.buildout 1.4.0 content = _open(os.path.dirname(file),os.path.join(directory, file),[], {}, {}, set()) except MissingSectionHeaderError: continue if content.has_key('eggnest'): yield content['eggnest'] else: log.warning("%s is not a directory." % directory)
def main(): try: base_path = sys.argv[1] except IndexError: print """ Usage: gs_download <path_to_buildout> This tool assumes in the path to the buildout lies a buildout.cfg and tries to parse it with the buildout parser. It assumes these minimum information in the buildout: [buildout] localip = # 127.0.0.1 plonefolder = # Plone # The Plone folder generated when creating a plone site login = # admin # The admin login name password = # admin # The admin password [ports] instance = # 8080 # The tcp port on which a zope instance is listening on It will always untgz the full genericsetup export in the buildout subdirectory gs. The gs directory is not meant for versioning customizations, please use your products profiles for that. The gs directory is just a security mechanism to check that any configuration change that happens to get tracked by genericsetup, gets documented in some form. This script assumes that the full buildout directory is under git version control, including the gs directory. This script returns it results only to the console. If everything is fine, nothing will be returned. The script is meant to be run by cron, which automatically sends mails when any of its programs produce any form of output. """ sys.exit(1) # We use buildout internal api and just experimented until we get the # desired results. config = buildout._open("", os.path.join(base_path, "buildout.cfg"), [], {}, {}) url = ("http://%s:%s/%s/portal_setup/manage_exportSteps/" "manage_exportAllSteps?__ac_name=%s&__ac_password=%s") % ( config["buildout"]["localip"][0], config["ports"]["instance"][0], config["buildout"]["plonefolder"][0], config["buildout"]["login"][0], config["buildout"]["password"][0], ) tgz = tarfile.TarFile.open(fileobj=urllib.urlopen(url), mode="r|gz") tgz.extractall(os.path.join(base_path, "gs")) os.system("git diff") os.system("git status")