예제 #1
0
def main(args=None):
    parser = argparse.ArgumentParser(description='Create wheels for all given project versions and upload them to the given index.')
    parser.add_argument('requirements', help='requirements.txt style file specifying which project versions to package.')
    parser.add_argument('index', help='The index to upload the packaged software to.')
    parser.add_argument('user', help='The user to log in as.')
    parser.add_argument('password', help='Password of the user.')
    parser.add_argument('--blacklist', help='Packages matched by this requirements.txt style file will never be build.')
    parser.add_argument('--pure-index', help='The index to use for pure packages. Any non-pure package will be uploaded '
                                             'to the index given as positional argument. Packages already found in the '
                                             'pure index will not be built, either.'
    )
    parser.add_argument('--junit-xml', help='Write information about the build success / failure to a JUnit-compatible XML file.')
    parser.add_argument('--dry-run', help='Build missing wheels, but do not modify the state of the devpi server.', action='store_true')
    parser.add_argument('--client-cert', help='Client key to use to authenticate with the devpi server.', default=None)

    args = parser.parse_args(args=args)

    packages = requirements.read(args.requirements)
    with wheeler.Builder() as builder, DevpiClient(args.index, args.user, args.password, client_cert=args.client_cert) as devpi_client:
        if args.pure_index:
            with DevpiClient(args.pure_index, args.user, args.password, client_cert=args.client_cert) as pure_index_client:
                processor = Processor(builder, devpi_client, args.blacklist, pure_index_client, junit_xml=args.junit_xml, dry_run=args.dry_run)
                processor.build_packages(packages)
        else:
            processor = Processor(builder, devpi_client, args.blacklist, junit_xml=args.junit_xml, dry_run=args.dry_run)
            processor.build_packages(packages)
 def test_comments(self):
     expected = [
         ('progressbar', '2.2')
     ]
     self.assertListEqual(
         expected,
         requirements.read('tests/fixture/sample_comments.txt')
     )
 def test_read_requirements(self):
     expected = [
         ('progressbar', '2.2'),
         ('six', '1.7.3')
     ]
     self.assertListEqual(
         expected,
         requirements.read('tests/fixture/sample_simple.txt')
     )
 def test_multiple_versions(self):
     expected = [
         ('progressbar', '2.2'),
         ('progressbar', '2.1')
     ]
     self.assertListEqual(
         expected,
         requirements.read('tests/fixture/sample_multiple_versions.txt')
     )
예제 #5
0
def main(args=None):
    parser = argparse.ArgumentParser(
        description=
        'Create wheels for all given project versions and upload them to the given index.'
    )
    parser.add_argument(
        'requirements',
        help=
        'requirements.txt style file specifying which project versions to package.'
    )
    parser.add_argument('index',
                        help='The index to upload the packaged software to.')
    parser.add_argument('user', help='The user to log in as.')
    parser.add_argument('password', help='Password of the user.')
    parser.add_argument(
        '--blacklist',
        help=
        'Packages matched by this requirements.txt style file will never be build.'
    )
    parser.add_argument(
        '--pure-index',
        help=
        'The index to use for pure packages. Any non-pure package will be uploaded '
        'to the index given as positional argument. Packages already found in the '
        'pure index will not be built, either.')
    parser.add_argument(
        '--junit-xml',
        help=
        'Write information about the build success / failure to a JUnit-compatible XML file.'
    )

    args = parser.parse_args(args=args)

    packages = requirements.read(args.requirements)
    with wheeler.Builder() as builder, devpi.Client(
            args.index, args.user, args.password) as devpi_client:
        if args.pure_index:
            with devpi.Client(args.pure_index, args.user,
                              args.password) as pure_index_client:
                processor = Processor(builder,
                                      devpi_client,
                                      args.blacklist,
                                      pure_index_client,
                                      junit_xml=args.junit_xml)
                processor.build_packages(packages)
        else:
            processor = Processor(builder,
                                  devpi_client,
                                  args.blacklist,
                                  junit_xml=args.junit_xml)
            processor.build_packages(packages)
예제 #6
0
def main(args=None):
    parser = argparse.ArgumentParser(description='Create wheels for all given project versions and upload them to the given index.')
    parser.add_argument('requirements', help='requirements.txt style file specifying which project versions to package.')
    parser.add_argument('index', help='The index to upload the packaged software to.')
    parser.add_argument('user', help='The user to log in as.')
    parser.add_argument('password', help='Password of the user.')
    parser.add_argument('--blacklist', help='Packages matched by this requirements.txt style file will never be build.')

    args = parser.parse_args(args=args)

    with wheeler.Builder() as builder, devpi.Client(args.index, args.user, args.password) as devpi_client:
        for package, version in requirements.read(args.requirements):

            if devpi_client.package_version_exists(package, version):
                logger.debug('Skipping %s %s as is already available on the index.', package, version)
            elif args.blacklist and requirements.matched_by_file(package, version, args.blacklist):
                logger.info('Skipping %s %s as it is matched by the blacklist.', package, version)
            else:
                logger.info('Building %s %s', package, version)
                try:
                    wheel_file = builder(package, version)
                    devpi_client.upload(wheel_file)
                except wheeler.BuildError as e:
                    logger.exception(e)
 def test_fail_on_multiple_versions_on_line(self):
     with self.assertRaises(ValueError):
         requirements.read('tests/fixture/sample_multiple_versions_on_line.txt')
 def test_fail_on_no_version(self):
     with self.assertRaises(ValueError):
         requirements.read('tests/fixture/sample_no_version.txt')
예제 #9
0
 def test_read_requirements(self):
     expected = [('progressbar', '2.2'), ('six', '1.7.3')]
     self.assertListEqual(
         expected, requirements.read('tests/fixture/sample_simple.txt'))
예제 #10
0
 def test_fail_on_multiple_versions_on_line(self):
     with self.assertRaises(ValueError):
         requirements.read(
             'tests/fixture/sample_multiple_versions_on_line.txt')
예제 #11
0
 def test_fail_on_no_version(self):
     with self.assertRaises(ValueError):
         requirements.read('tests/fixture/sample_no_version.txt')
예제 #12
0
 def test_multiple_versions(self):
     expected = [('progressbar', '2.2'), ('progressbar', '2.1')]
     self.assertListEqual(
         expected,
         requirements.read('tests/fixture/sample_multiple_versions.txt'))
 def test_comments(self):
     expected = [('progressbar', '2.2')]
     self.assertListEqual(
         expected, requirements.read('tests/fixture/sample_comments.txt'))