def buildout_newest_or_offline_context(self): parameters = [] if self.arguments.get('--newest'): parameters.append('-n') if self.arguments.get('--offline'): parameters.append('-o') with utils.buildout_parameters_context(parameters): yield
def create_scripts(self): additional_options = [ "buildout:prefer-final=true" ] if self.arguments.get("--prefer-final") else [] if self.arguments.get("--no-wheels"): additional_options += ["buildout:extensions="] with utils.buildout_parameters_context(additional_options): self.install_sections_by_recipe("infi.recipe.console_scripts")
def install_isolated_python_if_necessary(self): from infi.execute import execute_assert_success, ExecutionError if not self.arguments.get("--use-isolated-python", False): return if not assertions.is_isolated_python_exists() or self.arguments.get("--newest", False): with utils.buildout_parameters_context(['buildout:develop=']): utils.execute_with_buildout("install {}".format(self.get_isolated_python_section_name())) self.arguments["--force-bootstrap"] = True utils.execute_with_isolated_python(self._get_bootstrap_command())
def install_isolated_python_if_necessary(self): if not self.arguments.get("--use-isolated-python", False): return self._remove_setuptools_egg_link() if not assertions.is_isolated_python_exists() or self.arguments.get("--newest", False): with utils.buildout_parameters_context(['buildout:develop=']): utils.execute_with_buildout("install {}".format(self.get_isolated_python_section_name())) self.arguments["--force-bootstrap"] = True utils.execute_with_isolated_python(self._get_bootstrap_command())
def install_isolated_python_if_necessary(self): from os import environ if not self.arguments.get("--use-isolated-python", False): return self._remove_setuptools_egg_link() if not assertions.is_isolated_python_exists() or self.arguments.get("--newest", False): with utils.buildout_parameters_context(['buildout:develop=', 'buildout:versions=no', 'no:key=value']): utils.execute_with_buildout("install {}".format(self.get_isolated_python_section_name())) self._get_pip() self._install_setuptools_and_zc_buildout() env = environ.copy() env['PYTHONPATH'] = '' utils.execute_assert_success([utils.get_isolated_executable('buildout'), 'bootstrap'], env=env)
def freeze(self): from infi.projector.helper.utils import freeze_versions, buildout_parameters_context, open_tempfile from infi.projector.plugins.builtins.devenv import DevEnvPlugin from gitpy import LocalRepository from os import curdir from re import sub, findall, MULTILINE plugin = DevEnvPlugin() plugin.arguments = { '--newest': self.arguments.get("--newest", False), '--use-isolated-python': True } with open_tempfile() as tempfile: with buildout_parameters_context([ "buildout:update-versions-file={0}".format(tempfile), "buildout:versions=" ]): plugin.build() with open(tempfile) as fd: content = fd.read() post_releases = findall(r'^[^#].* = .*\.post.*', content, MULTILINE) if post_releases: if self.arguments.get('--allow-post-releases'): pass elif self.arguments.get('--strip-suffix-from-post-releases'): content = sub(r'\.post\d+', '', content) else: msg = "freeze found the follwing post-releases, see the dependency tree above:\n{}" formatted_post_releases = "\n".join( item for item in post_releases) logger.info(content) logger.error(msg.format(formatted_post_releases)) raise SystemExit(1) with open(tempfile, 'w') as fd: fd.write("[versions]\n" + "\n".join(set(content.splitlines()))) freeze_versions( tempfile, self.arguments.get("--with-install-requires", False)) if self.arguments.get("--commit-changes", False): repository = LocalRepository(curdir) repository.add("buildout.cfg") repository.commit("Freezing dependencies", allowEmpty=True) push_changes = self.arguments.get("--push-changes", False) if push_changes: repository._executeGitCommandAssertSuccess("git push")
def freeze(self): from infi.projector.helper.utils import freeze_versions, buildout_parameters_context, open_tempfile from infi.projector.plugins.builtins.devenv import DevEnvPlugin from gitpy import LocalRepository from os import curdir plugin = DevEnvPlugin() plugin.arguments = {'--newest': self.arguments.get("--newest", False)} with open_tempfile() as tempfile: with buildout_parameters_context(["buildout:update-versions-file={0}".format(tempfile)]): plugin.build() with open(tempfile) as fd: content = fd.read() with open(tempfile, 'w') as fd: fd.write("[versions]\n" + content) freeze_versions(tempfile, self.arguments.get("--with-install-requires", False)) if self.arguments.get("--commit-changes", False): repository = LocalRepository(curdir) repository.add("buildout.cfg") repository.commit("Freezing dependencies") push_changes = self.arguments.get("--push-changes", False) if push_changes: repository._executeGitCommandAssertSuccess("git push")
def freeze(self): from infi.projector.helper.utils import freeze_versions, buildout_parameters_context, open_tempfile from infi.projector.plugins.builtins.devenv import DevEnvPlugin from gitpy import LocalRepository from os import curdir from re import sub, findall, MULTILINE plugin = DevEnvPlugin() plugin.arguments = {'--newest': self.arguments.get("--newest", False), '--use-isolated-python': True} with open_tempfile() as tempfile: with buildout_parameters_context(["buildout:update-versions-file={0}".format(tempfile), "buildout:versions="]): plugin.build() with open(tempfile) as fd: content = fd.read() post_releases = findall(r'^[^#].* = .*\.post.*', content, MULTILINE) if post_releases: if self.arguments.get('--allow-post-releases'): pass elif self.arguments.get('--strip-suffix-from-post-releases'): content = sub(r'\.post\d+', '', content) else: msg = "freeze found the follwing post-releases, see the dependency tree above:\n{}" formatted_post_releases = "\n".join(item for item in post_releases) logger.info(content) logger.error(msg.format(formatted_post_releases)) raise SystemExit(1) with open(tempfile, 'w') as fd: fd.write("[versions]\n" + "\n".join(set(content.splitlines()))) freeze_versions(tempfile, self.arguments.get("--with-install-requires", False)) if self.arguments.get("--commit-changes", False): repository = LocalRepository(curdir) repository.add("buildout.cfg") repository.commit("Freezing dependencies", allowEmpty=True) push_changes = self.arguments.get("--push-changes", False) if push_changes: repository._executeGitCommandAssertSuccess("git push")
def freeze(self): from infi.projector.helper.utils import freeze_versions, buildout_parameters_context, open_tempfile from infi.projector.plugins.builtins.devenv import DevEnvPlugin from gitpy import LocalRepository from os import curdir plugin = DevEnvPlugin() plugin.arguments = {'--newest': self.arguments.get("--newest", False)} with open_tempfile() as tempfile: with buildout_parameters_context( ["buildout:update-versions-file={0}".format(tempfile)]): plugin.build() with open(tempfile) as fd: content = fd.read() with open(tempfile, 'w') as fd: fd.write("[versions]\n" + content) freeze_versions( tempfile, self.arguments.get("--with-install-requires", False)) if self.arguments.get("--commit-changes", False): repository = LocalRepository(curdir) repository.add("buildout.cfg") repository.commit("Freezing dependencies") push_changes = self.arguments.get("--push-changes", False) if push_changes: repository._executeGitCommandAssertSuccess("git push")
def submodule_update(self): with utils.buildout_parameters_context(['buildout:develop=']): self.install_sections_by_recipe("zerokspot.recipe.git") self.install_sections_by_recipe("gitrecipe") self.install_sections_by_recipe("git-recipe")
def create_setup_py(self): with utils.buildout_parameters_context(['buildout:develop=']): self.install_sections_by_recipe("infi.recipe.template.version")
def download_js_requirements(self): with utils.buildout_parameters_context(['buildout:develop=']): self.install_sections_by_recipe('infi.recipe.js_requirements')
def create_scripts(self): additional_options = ["buildout:prefer-final=true"] if self.arguments.get("--prefer-final") else [] with utils.buildout_parameters_context(additional_options): self.install_sections_by_recipe("infi.recipe.console_scripts") self.install_sections_by_recipe("infi.recipe.console_scripts:gui_scripts")
def submodule_update(self): with utils.buildout_parameters_context(['buildout:develop=']): self.install_sections_by_recipe("zerokspot.recipe.git")