Beispiel #1
0
    def run(self):
        # Run the egg_info step to find our VCS url.
        self.run_command('egg_info')
        if not self.distribution.metadata.url:
            log.warn("This package does not appear to be in any repository, "
                     "aborting.")
            sys.exit(1)

        # Pull down Jenkins package
        base.fetch_build_eggs(['python-jenkins'], dist=self.distribution)
        from jenkins import Jenkins
        server = CONFIG.jenkins_url
        log.info("Connecting to Jenkins at %s" % server)

        jenkins = Jenkins(server, self.username, self.password)
        name = self.distribution.metadata.name

        if (self.matrix):
            log.info("Matrix job")
            if CONFIG.jenkins_matrix_job_xml:
                path, fname = CONFIG.jenkins_matrix_job.split(':')
            else:
                path, fname = None, 'jenkins_job_matrix.xml'
        else:
            log.info(
                "Non-matrix job - use \'--matrix\' option for matrix builds")
            if CONFIG.jenkins_job_xml:
                path, fname = CONFIG.jenkins_job.split(':')
            else:
                path, fname = None, 'jenkins_job.xml'

        with open(base.get_resource_file(fname, path)) as f:
            jenkins_config_xml = Template(f.read())

        cfg_xml = jenkins_config_xml.safe_substitute(
            name=cgi.escape(name),
            hyphen_escaped_name=cgi.escape(name).replace("-", "?").replace(
                "_", "?"),
            description=cgi.escape(self.distribution.metadata.description),
            repository=self.distribution.metadata.url,
            email=self.distribution.metadata.author_email,
            python_string_xml=self._construct_string_values(
                self._get_active_python_versions()),
            virtualenv=CONFIG.virtualenv_executable,
            username=self.username)

        if jenkins.job_exists(name):
            log.error(
                "Job found at %s/job/%s Please delete this before creating a new one."
                % (server, name))
        else:
            if (not self.dry_run):
                log.info("Creating job at %s/job/%s" % (server, name))
                jenkins.create_job(name, cfg_xml)
Beispiel #2
0
    def run(self):
        # Run the egg_info step to find our VCS url.
        self.run_command('egg_info')
        if not self.distribution.metadata.url:
            log.warn("This package does not appear to be in any repository, "
                     "aborting.")
            sys.exit(1)

        # Pull down Jenkins package
        base.fetch_build_eggs(['python-jenkins'], dist=self.distribution)
        from jenkins import Jenkins
        server = CONFIG.jenkins_url
        log.info("Connecting to Jenkins at %s" % server)

        jenkins = Jenkins(server, self.username, self.password)
        name = self.distribution.metadata.name

        if (self.matrix):
            log.info("Matrix job")
            if CONFIG.jenkins_matrix_job_xml:
                path, fname = CONFIG.jenkins_matrix_job.split(':')
            else:
                path, fname = None, 'jenkins_job_matrix.xml'
        else:
            log.info("Non-matrix job - use \'--matrix\' option for matrix builds")
            if CONFIG.jenkins_job_xml:
                path, fname = CONFIG.jenkins_job.split(':')
            else:
                path, fname = None, 'jenkins_job.xml'

        with open(base.get_resource_file(fname, path)) as f:
            jenkins_config_xml = Template(f.read())

        cfg_xml = jenkins_config_xml.safe_substitute(
            name=cgi.escape(name),
            hyphen_escaped_name=cgi.escape(name).replace("-", "?").replace("_", "?"),
            description=cgi.escape(self.distribution.metadata.description),
            repository=self.distribution.metadata.url,
            email=self.distribution.metadata.author_email,
            python_string_xml=self._construct_string_values(self._get_active_python_versions()),
            virtualenv=CONFIG.virtualenv_executable,
            username=self.username
        )

        if jenkins.job_exists(name):
            log.error("Job found at %s/job/%s Please delete this before creating a new one." % (server, name))
        else:
            if (not self.dry_run):
                log.info("Creating job at %s/job/%s" % (server, name))
                jenkins.create_job(name, cfg_xml)
Beispiel #3
0
    def fetch_requirements(self):
        """ Download any missing requirements to local pkg dir.
            This will allow you to use anything that gets pulled in for
            by tests_require as well, eg pytest, pytest-cov etc.
        """
        all_requirements = self.get_requirements(extras=True, test=True)

        # We always need Py.Test with the coverage module.
        all_requirements.add('pytest')
        all_requirements.add('pytest-cov')

        # We need pylint if we're running in Hudson mode
        if CONFIG.test_linter_package and self.hudson and not self.no_pylint:
            all_requirements.add(CONFIG.test_linter_package)

        fetch_build_eggs(list(all_requirements), dist=self.distribution,
                         prefer_final=False, use_existing=True, add_to_env=True)
Beispiel #4
0
    def fetch_requirements(self):
        """ Download any missing requirements to local pkg dir.
            This will allow you to use anything that gets pulled in for
            by tests_require as well, eg pytest, pytest-cov etc.
        """
        all_requirements = self.get_requirements(extras=True, test=True)

        # We always need Py.Test with the coverage module.
        all_requirements.add('pytest')
        all_requirements.add('pytest-cov')

        # We need pylint if we're running in Hudson mode
        if CONFIG.test_linter_package and self.hudson and not self.no_pylint:
            all_requirements.add(CONFIG.test_linter_package)

        fetch_build_eggs(list(all_requirements),
                         dist=self.distribution,
                         prefer_final=False,
                         use_existing=True,
                         add_to_env=True)