示例#1
0
 def install_sections_by_recipe(self, recipe, stripped=True):
     with utils.open_buildout_configfile() as buildout:
         sections_to_install = [section for section in buildout.sections()
                                if buildout.has_option(section, "recipe") and
                                   buildout.get(section, "recipe").startswith(recipe)]
     if sections_to_install:
         utils.execute_with_buildout("install {}".format(' '.join(sections_to_install)), stripped=stripped)
示例#2
0
 def install_sections_by_recipe(self, recipe, stripped=True):
     with utils.open_buildout_configfile() as buildout:
         sections_to_install = [section for section in buildout.sections()
                                if buildout.has_option(section, "recipe") and
                                   buildout.get(section, "recipe").startswith(recipe)]
     if sections_to_install:
         utils.execute_with_buildout("install {}".format(' '.join(sections_to_install)), stripped=stripped)
示例#3
0
 def install_sections_by_recipe(self, recipe):
     with utils.open_buildout_configfile() as buildout:
         sections_to_install = [section for section in buildout.sections()
                                if buildout.has_option(section, "recipe") and \
                                   buildout.get(section, "recipe") == recipe]
     if sections_to_install:
         utils.execute_with_buildout("install {}".format(' '.join(sections_to_install)))
示例#4
0
 def install_sections_by_recipe(self, recipe):
     with utils.open_buildout_configfile() as buildout:
         sections_to_install = [section for section in buildout.sections()
                                if buildout.has_option(section, "recipe") and \
                                   buildout.get(section, "recipe") == recipe]
     if sections_to_install:
         utils.execute_with_buildout("install {}".format(' '.join(sections_to_install)))
示例#5
0
 def test_execute_assert_success(self):
     from infi.projector.helper.utils import execute_with_buildout, PrettyExecutionError
     try:
         execute_with_buildout(["install", "non-existing-section"])
     except PrettyExecutionError as err:
         self.assertFalse(r"\n" in str(err))
     except OSError:
         raise SkipTest("bin/buildout not found")
示例#6
0
 def test_execute_assert_success(self):
     from infi.projector.helper.utils import execute_with_buildout, PrettyExecutionError
     try:
         execute_with_buildout(["install", "non-existing-section"])
     except PrettyExecutionError as err:
         self.assertFalse(r"\n" in str(err))
     except OSError:
         raise SkipTest("bin/buildout not found")
示例#7
0
 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())
示例#8
0
 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())
示例#9
0
 def build_and_upload_distributions(self, version_tag_with_v):
     from infi.projector.helper.utils import execute_with_buildout, git_checkout
     from infi.projector.plugins.builtins.devenv import DevEnvPlugin
     for distribution in self.arguments.get("--distributions").split(','):
         for pypi in self.arguments.get("--pypi-servers").split(','):
             if not pypi:
                 continue
             git_checkout(version_tag_with_v)
             DevEnvPlugin().create_setup_py()
             setup_cmd = "setup . register -r {pypi} {distribution} upload -r {pypi}"
             setup_cmd = setup_cmd.format(pypi=pypi, distribution=distribution)
             execute_with_buildout(setup_cmd, env=dict(LC_ALL="C"))
示例#10
0
 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)
示例#11
0
 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)
示例#12
0
 def build_and_upload_distributions(self, version_tag_with_v):
     from infi.projector.helper.utils import execute_with_buildout, git_checkout
     from infi.projector.plugins.builtins.devenv import DevEnvPlugin
     from infi.projector.scripts import projector
     from gitpy import LocalRepository
     from os import curdir
     repository = LocalRepository(curdir)
     for distribution in self.arguments.get("--distributions").split(','):
         for pypi in self.arguments.get("--pypi-servers").split(','):
             git_checkout(version_tag_with_v)
             DevEnvPlugin().create_setup_py()
             setup_cmd = "setup . register -r {pypi} {distribution} upload -r {pypi}"
             setup_cmd = setup_cmd.format(pypi=pypi, distribution=distribution)
             execute_with_buildout(setup_cmd)
示例#13
0
 def build_and_upload_distributions(self, version_tag_with_v):
     from infi.projector.helper.utils import execute_with_buildout, git_checkout
     from infi.projector.plugins.builtins.devenv import DevEnvPlugin
     from infi.projector.scripts import projector
     from gitpy import LocalRepository
     from os import curdir
     repository = LocalRepository(curdir)
     for distribution in self.arguments.get("--distributions").split(','):
         for pypi in self.arguments.get("--pypi-servers").split(','):
             git_checkout(version_tag_with_v)
             DevEnvPlugin().create_setup_py()
             setup_cmd = "setup . register -r {pypi} {distribution} upload -r {pypi}"
             setup_cmd = setup_cmd.format(pypi=pypi,
                                          distribution=distribution)
             execute_with_buildout(setup_cmd)
示例#14
0
    def build_and_upload_distributions(self, version_tag_with_v):
        from infi.projector.helper.utils import execute_with_buildout, git_checkout
        from infi.projector.plugins.builtins.devenv import DevEnvPlugin

        with open('setup.py') as fd:
            has_c_extensions = 'ext_modules' in fd.read()

        for distribution in self.arguments.get("--distributions").split(','):
            for pypi in self.arguments.get("--pypi-servers").split(','):
                if not pypi:
                    continue
                git_checkout(version_tag_with_v)
                DevEnvPlugin().create_setup_py()
                setup_cmd = "setup . {distribution} upload -r {pypi} {universal_flag}"
                universal_flag = '--universal' if distribution == 'bdist_wheel' and has_c_extensions else ''
                setup_cmd = setup_cmd.format(pypi=pypi, distribution=distribution, universal_flag=universal_flag).strip()
                execute_with_buildout(setup_cmd, env=dict(LC_ALL="C"))
                git_checkout("develop")
示例#15
0
    def build_and_upload_distributions(self, version_tag_with_v):
        from infi.projector.helper.utils import execute_with_buildout, git_checkout
        from infi.projector.plugins.builtins.devenv import DevEnvPlugin
        from infi.execute import execute_assert_success
        from sys import argv
        from os.path import join, dirname
        from shutil import rmtree
        from tempfile import mkdtemp

        with open('setup.py') as fd:
            has_c_extensions = 'ext_modules' in fd.read()

        for distribution in self.arguments.get("--distributions").split(','):
            for pypi in self.arguments.get("--pypi-servers").split(','):
                if not pypi:
                    continue
                git_checkout(version_tag_with_v)
                DevEnvPlugin().create_setup_py()
                setup_cmd = "setup . {distribution}{universal_flag} --dist-dir={temp_dir}"
                universal_flag = ' --universal' if distribution == 'bdist_wheel' and has_c_extensions else ''
                temp_dir = mkdtemp()
                logger.info(
                    "Created temp dir {temp_dir}".format(temp_dir=temp_dir))
                try:
                    setup_cmd = setup_cmd.format(pypi=pypi,
                                                 distribution=distribution,
                                                 universal_flag=universal_flag,
                                                 temp_dir=temp_dir).strip()
                    execute_with_buildout(setup_cmd, env=dict(LC_ALL="C"))
                    upload_cmd = "{twine_path} upload --repository {pypi} {temp_dir}"
                    twine_path = join(dirname(argv[0]), "twine")
                    upload_cmd = upload_cmd.format(twine_path=twine_path,
                                                   pypi=pypi,
                                                   temp_dir=join(
                                                       temp_dir, '*'))
                    execute_assert_success(upload_cmd, shell=True)
                finally:
                    git_checkout("develop")
                    logger.info("Removing temp dir {temp_dir}".format(
                        temp_dir=temp_dir))
                    rmtree(temp_dir)
示例#16
0
    def build_and_upload_distributions(self, version_tag_with_v):
        from infi.projector.helper.utils import execute_with_buildout, git_checkout
        from infi.projector.plugins.builtins.devenv import DevEnvPlugin

        with open('setup.py') as fd:
            has_c_extensions = 'ext_modules' in fd.read()

        for distribution in self.arguments.get("--distributions").split(','):
            for pypi in self.arguments.get("--pypi-servers").split(','):
                if not pypi:
                    continue
                git_checkout(version_tag_with_v)
                DevEnvPlugin().create_setup_py()
                setup_cmd = "setup . register -r {pypi} {distribution} upload -r {pypi} {universal_flag}"
                universal_flag = '--universal' if distribution == 'bdist_wheel' and has_c_extensions else ''
                setup_cmd = setup_cmd.format(
                    pypi=pypi,
                    distribution=distribution,
                    universal_flag=universal_flag).strip()
                execute_with_buildout(setup_cmd, env=dict(LC_ALL="C"))
                git_checkout("develop")