Skip to content

Commit 2991357

Browse files
Merge pull request #1 from dillon-giacoppo/dillon-import-from-rules-pip
2 parents 867fdab + 310053e commit 2991357

File tree

506 files changed

+152856
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

506 files changed

+152856
-0
lines changed

BUILD

Whitespace-only changes.

WORKSPACE

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
workspace(name = "rules_pip")
2+
3+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4+
5+
http_archive(
6+
name = "rules_python",
7+
url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz",
8+
sha256 = "aa96a691d3a8177f3215b14b0edc9641787abaaa30363a080165d06ab65e1161",
9+
)
10+
load("@rules_python//python:repositories.bzl", "py_repositories")
11+
py_repositories()
12+
13+
load("//:defs.bzl", "pip_repository")
14+
15+
pip_repository(
16+
name = "py_deps",
17+
requirements = "//:requirements.txt",
18+
)

defs.bzl

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
def _pip_repository_impl(rctx):
2+
if not rctx.which("python3"):
3+
fail("python not found")
4+
5+
rctx.file("BUILD", "")
6+
7+
result = rctx.execute(
8+
[
9+
rctx.which("python3"),
10+
rctx.path(rctx.attr._script),
11+
"--requirements",
12+
rctx.path(rctx.attr.requirements),
13+
"--repo",
14+
"@%s" % rctx.attr.name,
15+
],
16+
17+
environment = rctx.attr.wheel_env,
18+
)
19+
if result.return_code:
20+
fail("failed to create pip repository: %s (%s)" % (result.stdout, result.stderr))
21+
22+
return
23+
24+
25+
pip_repository = repository_rule(
26+
attrs={
27+
"requirements": attr.label(allow_single_file=True, mandatory=True,),
28+
"wheel_env": attr.string_dict(),
29+
"_script": attr.label(
30+
executable=True,
31+
default=Label("//tools:wheel_wrapper.py"),
32+
cfg="host",
33+
),
34+
},
35+
local=False,
36+
implementation=_pip_repository_impl,
37+
)

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cryptography[test, docs]
2+
boto3

third_party/bin/easy_install

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/Users/dillon/devel/dillon-giacoppo/rules_pip/venv/bin/python3
2+
# -*- coding: utf-8 -*-
3+
import re
4+
import sys
5+
6+
from setuptools.command.easy_install import main
7+
8+
if __name__ == '__main__':
9+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
10+
sys.exit(main())

third_party/bin/easy_install-3.7

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/Users/dillon/devel/dillon-giacoppo/rules_pip/venv/bin/python3
2+
# -*- coding: utf-8 -*-
3+
import re
4+
import sys
5+
6+
from setuptools.command.easy_install import main
7+
8+
if __name__ == '__main__':
9+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
10+
sys.exit(main())

third_party/bin/pip

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/Users/dillon/devel/dillon-giacoppo/rules_pip/venv/bin/python3
2+
# -*- coding: utf-8 -*-
3+
import re
4+
import sys
5+
6+
from pip._internal.main import main
7+
8+
if __name__ == '__main__':
9+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
10+
sys.exit(main())

third_party/bin/pip3

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/Users/dillon/devel/dillon-giacoppo/rules_pip/venv/bin/python3
2+
# -*- coding: utf-8 -*-
3+
import re
4+
import sys
5+
6+
from pip._internal.main import main
7+
8+
if __name__ == '__main__':
9+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
10+
sys.exit(main())

third_party/bin/pip3.7

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/Users/dillon/devel/dillon-giacoppo/rules_pip/venv/bin/python3
2+
# -*- coding: utf-8 -*-
3+
import re
4+
import sys
5+
6+
from pip._internal.main import main
7+
8+
if __name__ == '__main__':
9+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
10+
sys.exit(main())

third_party/bin/pkginfo

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/Users/dillon/devel/dillon-giacoppo/rules_pip/venv/bin/python3
2+
# -*- coding: utf-8 -*-
3+
import re
4+
import sys
5+
6+
from pkginfo.commandline import main
7+
8+
if __name__ == '__main__':
9+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
10+
sys.exit(main())

0 commit comments

Comments
 (0)