Example #1
0
def test_pinned():
    vendor_spec = VendorSpec.pinned("foo", "1.2.3")
    assert "foo" == vendor_spec.key
    assert "foo==1.2.3" == vendor_spec.requirement
Example #2
0
def test_vcs_invalid_multiple_egg():
    with pytest.raises(ValueError):
        VendorSpec.vcs(
            "git+https://github.com/foo.git@da39a3ee#egg=bar&egg=foo")
Example #3
0
def test_vcs_invalid_no_egg():
    with pytest.raises(ValueError):
        VendorSpec.vcs("git+https://github.com/foo.git@da39a3ee")
Example #4
0
def test_vcs_valid():
    vendor_spec = VendorSpec.vcs(
        "git+https://github.com/foo.git@da39a3ee#egg=bar")
    assert "bar" == vendor_spec.key
    assert "git+https://github.com/foo.git@da39a3ee#egg=bar" == vendor_spec.requirement
Example #5
0
                    modifications = import_rewriter.rewrite(python_file)
                    if modifications:
                        num_mods = len(modifications)
                        print(
                            bold(
                                green(
                                    "  Vendorized {count} import{plural} in {python_file}"
                                    .format(
                                        count=num_mods,
                                        plural="s" if num_mods > 1 else "",
                                        python_file=python_file,
                                    ))))
                        for _from, _to in modifications.items():
                            print("    {} -> {}".format(_from, _to))


if __name__ == "__main__":
    if len(sys.argv) != 1:
        print("Usage: {}".format(sys.argv[0]), file=sys.stderr)
        sys.exit(1)

    root_directory = VendorSpec.ROOT
    import_prefix = third_party.import_prefix()
    try:
        safe_rmtree(VendorSpec.vendor_root())
        vendorize(root_directory, list(iter_vendor_specs()), import_prefix)
        sys.exit(0)
    except VendorizeError as e:
        print("Problem encountered vendorizing: {}".format(e), file=sys.stderr)
        sys.exit(1)
Example #6
0
def test_pinned():
    vendor_spec = VendorSpec.pinned('foo', '1.2.3')
    assert 'foo' == vendor_spec.key
    assert 'foo==1.2.3' == vendor_spec.requirement