示例#1
0
 def test_throws_custom_on_build_failure(self):
     with wheeler.Builder() as builder:
         with pytest.raises(wheeler.BuildError) as info:
             builder('package_that_hopefully_does_not_exist', '99.999')
         info.match(
             r'(Could not find a version that satisfies the requirement package[-_]that[-_]hopefully[-_]does[-_]not[-_]exist==99.999 \(from versions: \))|(Could not find any downloads that satisfy the requirement package-that-hopefully-does-not-exist==99.999)'
         )
示例#2
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)
示例#3
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('--batch',
                        default=False,
                        action='store_true',
                        help='Batch mode. Do not prompt for credentials')
    parser.add_argument('--user',
                        default=os.environ.get('DEVPI_USER'),
                        help='The user to log in as.')
    parser.add_argument('--password',
                        default=os.environ.get('DEVPI_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('--run-id',
                        help='Add the given string to all entries in the XML output, allowing to distinguish output from multiple runs in a merged XML.')
    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)
    if not args.batch:
        if args.user is None:
            args.user = input('Username: '******'Password: ')

    packages = requirements.read_exact_versions(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, run_id=args.run_id)
                processor.build_packages(packages)
        else:
            processor = Processor(builder, devpi_client, args.blacklist, junit_xml=args.junit_xml, dry_run=args.dry_run,
                                  run_id=args.run_id)
            processor.build_packages(packages)
 def test_build(self):
     with wheeler.Builder() as builder:
         wheel_file = builder('progressbar', '2.2')
         self.assertRegexpMatches(wheel_file, '\.whl$')
         self.assertTrue(path.exists(wheel_file))
 def test_look_for_non_existing_wheel(self):
     builder = wheeler.Builder()
     with builder:
         with self.assertRaises(wheeler.BuildError):
             builder._find_wheel('nothing_can_be_found', '1.1')
 def test_provides_file_that_is_already_a_wheel(self):
     with wheeler.Builder() as builder:
         wheel_file = builder('wheel', '0.24')
         self.assertTrue(path.exists(wheel_file))
 def test_cleans_up_created_files(self):
     with wheeler.Builder() as builder:
         wheel_file = builder('progressbar', '2.2')
     self.assertFalse(path.exists(wheel_file))
示例#8
0
 def test_throws_custom_on_build_failure(self):
     with wheeler.Builder() as builder:
         with self.assertRaises(wheeler.BuildError):
             builder('package_that_hopefully_does_not_exist', '99.999')
示例#9
0
 def test_build(self):
     with wheeler.Builder() as builder:
         wheel_file = builder('progressbar', '2.2')
         assert re.match(r'.*\.whl$', wheel_file)
         assert path.exists(wheel_file)