Example #1
0
 def env_spec_fh(self, spec):
     with tempdir('env_spec') as tmpdir:
         fpath = os.path.join(tmpdir, 'env.spec')
         with open(fpath, 'w') as fh:
             fh.write(textwrap.dedent(spec))
         with open(fpath) as fh:
             yield fh
Example #2
0
def handle_args(args):
    with tempdir() as repo_directory:
        repo = Repo.clone_from(args.repo_uri, repo_directory)
        create_tracking_branches(repo)
        for tag in tag_by_branch(repo):
            print('Pushing tag {}'.format(tag.name))
            repo.remotes.origin.push(tag)
Example #3
0
def handle_args(args):
    # To reduce the noise coming from conda/conda-build we set
    # all loggers to WARN level.
    logging.getLogger('').setLevel(logging.WARNING)
    for logger_name in logging.Logger.manager.loggerDict.keys():
        logger = logging.getLogger(logger_name)
        logger.setLevel(logging.WARNING)

    config = Config(args.config)
    state = {}
    if args.state is not None:
        fname = os.path.abspath(os.path.expanduser(args.state))
        with open(fname, 'r') as fi:
            state = yaml.safe_load(fi) or {}
    with tempdir() as repo_directory:
        repo = Repo.clone_from(args.repo_uri, repo_directory)
        create_tracking_branches(repo)
        create_rpmbuild_content(repo,
                                args.target,
                                config,
                                state,
                                env_labels=args.env_labels,
                                api_user=args.api_user,
                                api_key=args.api_key)
        create_rpm_installer(args.target, config)
Example #4
0
 def env_spec_fh(self, spec):
     with tempdir('env_spec') as tmpdir:
         fpath = os.path.join(tmpdir, 'env.spec')
         with open(fpath, 'w') as fh:
             fh.write(textwrap.dedent(spec))
         with open(fpath) as fh:
             yield fh
Example #5
0
def handle_args(args):
    with tempdir() as repo_directory:
        repo = Repo.clone_from(args.repo_uri, repo_directory)
        create_tracking_branches(repo)
        for tag in tag_by_branch(repo):
            print("Pushing tag {}".format(tag.name))
            repo.remotes.origin.push(tag)
Example #6
0
def handle_args(args):
    with tempdir() as repo_directory:
        repo = Repo.clone_from(args.repo_uri, repo_directory)
        create_tracking_branches(repo)
        env_branch = progress_label(repo,
                                    args.next_tag,
                                    next_only=args.next_only)
        repo.remotes.origin.push(env_branch)
Example #7
0
    def test_specified_env_labels(self):
        with resolve.tempdir() as tmpdir:
            deploy.deploy_repo(self.repo, tmpdir, ['default/next', 'bleeding/*'])

            self.assertTrue(self.check_link_exists(tmpdir, 'default', 'next'))
            self.assertTrue(self.check_link_exists(tmpdir, 'bleeding', 'next'))
            self.assertTrue(self.check_link_exists(tmpdir, 'bleeding', 'latest'))
            
            self.assertFalse(os.path.exists(os.path.join(tmpdir, 'default', 'current')))
            self.assertFalse(os.path.exists(os.path.join(tmpdir, 'default', 'latest')))
Example #8
0
    def test(self):
        with resolve.tempdir() as tmpdir:
            deploy.deploy_repo(self.repo, tmpdir)

            self.assertTrue(self.check_link_exists(tmpdir, 'default', 'next'))
            self.assertTrue(self.check_link_exists(tmpdir, 'default', 'current'))
            self.assertTrue(self.check_link_exists(tmpdir, 'bleeding', 'next'))
            self.assertTrue(self.check_link_exists(tmpdir, 'bleeding', 'latest'))
            self.assertTrue(self.check_link_exists(tmpdir, 'default', 'latest'))

            # Check that we can resolve those links, finding the python executable.
            self.assertTrue(os.path.exists(os.path.join(tmpdir, 'bleeding', 'next', 'bin', 'python')))
Example #9
0
    def test_specified_env_labels(self):
        with resolve.tempdir() as tmpdir:
            deploy.deploy_repo(self.repo, tmpdir,
                               ['default/next', 'bleeding/*'])

            self.assertTrue(self.check_link_exists(tmpdir, 'default', 'next'))
            self.assertTrue(self.check_link_exists(tmpdir, 'bleeding', 'next'))
            self.assertTrue(
                self.check_link_exists(tmpdir, 'bleeding', 'latest'))

            self.assertFalse(
                os.path.exists(os.path.join(tmpdir, 'default', 'current')))
            self.assertFalse(
                os.path.exists(os.path.join(tmpdir, 'default', 'latest')))
Example #10
0
def handle_args(args):
    # To reduce the noise coming from conda/conda-build we set
    # all loggers to WARN level.
    logging.getLogger('').setLevel(logging.WARNING)
    for logger_name in logging.Logger.manager.loggerDict.keys():
        logger = logging.getLogger(logger_name)
        logger.setLevel(logging.WARNING)

    config = Config(args.config)
    with tempdir() as repo_directory:
        repo = Repo.clone_from(args.repo_uri, repo_directory)
        create_tracking_branches(repo)
        create_rpmbuild_content(repo, args.target, config)
        create_rpm_installer(args.target, config)
Example #11
0
    def test(self):
        with resolve.tempdir() as tmpdir:
            deploy.deploy_repo(self.repo, tmpdir)

            def link_target(env, label):
                link = os.path.join(tmpdir, env, label)
                target = os.path.join(tmpdir, env, os.readlink(link))
                return target 

            self.assertTrue(os.path.exists(link_target('default', 'next')))
            self.assertTrue(os.path.exists(link_target('default', 'current')))
            self.assertTrue(os.path.exists(link_target('bleeding', 'next')))
            self.assertTrue(os.path.exists(link_target('bleeding', 'latest')))
            self.assertTrue(os.path.exists(link_target('default', 'latest')))

            # Check that we can resolve those links, finding the python executable.
            self.assertTrue(os.path.exists(os.path.join(tmpdir, 'bleeding', 'next', 'bin', 'python')))
Example #12
0
    def test(self):
        with resolve.tempdir() as tmpdir:
            deploy.deploy_repo(self.repo, tmpdir)

            self.assertTrue(self.check_link_exists(tmpdir, 'default', 'next'))
            self.assertTrue(
                self.check_link_exists(tmpdir, 'default', 'current'))
            self.assertTrue(self.check_link_exists(tmpdir, 'bleeding', 'next'))
            self.assertTrue(
                self.check_link_exists(tmpdir, 'bleeding', 'latest'))
            self.assertTrue(self.check_link_exists(tmpdir, 'default',
                                                   'latest'))

            # Check that we can resolve those links, finding the python executable.
            self.assertTrue(
                os.path.exists(
                    os.path.join(tmpdir, 'bleeding', 'next', 'bin', 'python')))
Example #13
0
    def test(self):
        # Check that resolve_spec is returning the expected content.
        index = dummy_index.DummyIndex()
        index.add_pkg('foo', '2.7.0', depends=('bar', ), build_number=0)
        index.add_pkg('foo', '3.5.0', depends=('bar', ), build_number=0)
        index.add_pkg('bar', '1.2', build_number=0)

        with tempdir() as tmp:
            channel = index.write_to_channel(tmp)
            with self.env_spec_fh("""
                                channels:
                                    - file://{}
                                env:
                                    - foo
                                """.format(tmp)) as specfile:
                pkgs = resolve_spec(specfile)
        pkg_names = [line.split('\t')[-1] for line in pkgs]
        self.assertEqual(sorted(pkg_names), ['bar-1.2-0', 'foo-3.5.0-0'])
Example #14
0
    def test(self):
        # Check that resolve_spec is returning the expected content.
        index = dummy_index.DummyIndex()
        index.add_pkg('foo', '2.7.0', depends=('bar',))
        index.add_pkg('foo', '3.5.0', depends=('bar',))
        index.add_pkg('bar', '1.2')

        with tempdir() as tmp:
            channel = index.write_to_channel(tmp)
            with self.env_spec_fh("""
                                channels:
                                    - file://{}
                                env:
                                    - foo
                                """.format(tmp)) as specfile:
                pkgs = resolve_spec(specfile)
        pkg_names = [line.split('\t')[-1] for line in pkgs]
        self.assertEqual(sorted(pkg_names), ['bar-1.2-0', 'foo-3.5.0-0'])
Example #15
0
    def test(self):
        with resolve.tempdir() as tmpdir:
            deploy.deploy_repo(self.repo, tmpdir)

            def link_target(env, label):
                link = os.path.join(tmpdir, env, label)
                target = os.path.join(tmpdir, env, os.readlink(link))
                return target

            self.assertTrue(os.path.exists(link_target('default', 'next')))
            self.assertTrue(os.path.exists(link_target('default', 'current')))
            self.assertTrue(os.path.exists(link_target('bleeding', 'next')))
            self.assertTrue(os.path.exists(link_target('bleeding', 'latest')))
            self.assertTrue(os.path.exists(link_target('default', 'latest')))

            # Check that we can resolve those links, finding the python executable.
            self.assertTrue(
                os.path.exists(
                    os.path.join(tmpdir, 'bleeding', 'next', 'bin', 'python')))
 def create_repo(self):
     with resolve.tempdir() as tmpdir:
         repo = Repo.init(tmpdir)
         repo.index.commit("Initial commit.")
         yield repo
Example #17
0
def handle_args(args):
    with tempdir() as repo_directory:
        repo = Repo.clone_from(args.repo_uri, repo_directory)
        create_tracking_branches(repo)
        create_rpmbuild_content(repo, args.target)
        create_rpm_installer(args.target)
Example #18
0
 def test_some(self):
     expected = {'a': '123', 'abc123': 'foobar-again'}
     with resolve.tempdir() as labels_dir:
         label_tag.write_labels(labels_dir, expected)
         result = deploy.tags_by_label(labels_dir)
     self.assertEqual(result, expected)
Example #19
0
 def test_no_tags(self):
     expected = {}
     with resolve.tempdir() as labels_dir:
         label_tag.write_labels(labels_dir, expected)
         result = deploy.tags_by_label(labels_dir)
     self.assertEqual(result, expected)
Example #20
0
 def test_some(self):
     expected = {"a": "123", "abc123": "foobar-again"}
     with resolve.tempdir() as labels_dir:
         label_tag.write_labels(labels_dir, expected)
         result = deploy.tags_by_label(labels_dir)
     self.assertEqual(result, expected)
Example #21
0
def handle_args(args):
    with tempdir() as repo_directory:
        repo = Repo.clone_from(args.repo_uri, repo_directory)
        create_tracking_branches(repo)
        env_branch = progress_label(repo, args.next_tag, next_only=args.next_only)
        repo.remotes.origin.push(env_branch)
Example #22
0
 def create_repo(self):
     with resolve.tempdir() as tmpdir:
         repo = Repo.init(tmpdir)
         repo.index.commit('Initial commit.')
         yield repo
Example #23
0
def handle_args(args):
    with tempdir() as repo_directory:
        repo = Repo.clone_from(args.repo_uri, repo_directory)
        create_tracking_branches(repo)
        deploy_repo(repo, args.target, args.env_labels)
Example #24
0
def handle_args(args):
    with tempdir() as repo_directory:
        repo = Repo.clone_from(args.repo_uri, repo_directory)
        create_tracking_branches(repo)
        deploy_repo(repo, args.target, args.env_labels)
Example #25
0
 def test_no_tags(self):
     expected = {}
     with resolve.tempdir() as labels_dir:
         label_tag.write_labels(labels_dir, expected)
         result = deploy.tags_by_label(labels_dir)
     self.assertEqual(result, expected)