@@ -4,52 +4,15 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44
55http_archive (
66 name = "rules_python" ,
7- sha256 = "aa96a691d3a8177f3215b14b0edc9641787abaaa30363a080165d06ab65e1161" ,
8- url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz" ,
7+ url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.2/rules_python-0.0.2.tar.gz" ,
8+ strip_prefix = "rules_python-0.0.2" ,
9+ sha256 = "b5668cde8bb6e3515057ef465a35ad712214962f0b3a314e551204266c7be90c" ,
910)
1011
1112load ("@rules_python//python:repositories.bzl" , "py_repositories" )
1213
1314py_repositories ()
1415
15- # You could optionally use an in-build, compiled python interpreter as a toolchain,
16- # and also use it to execute pip.
17-
18- # Special logic for building python interpreter with OpenSSL from homebrew.
19- # See https://devguide.python.org/setup/#macos-and-os-x
20- _py_configure = """
21- if [[ "$OSTYPE" == "darwin"* ]]; then
22- ./configure --prefix=$(pwd)/bazel_install --with-openssl=$(brew --prefix openssl)
23- else
24- ./configure --prefix=$(pwd)/bazel_install
25- fi
26- """
27-
28- # NOTE: you need to have the SSL headers installed to build with openssl support (and use HTTPS).
29- # E.g. on Ubuntu: `sudo apt install libssl-dev`
30- http_archive (
31- name = "python_interpreter" ,
32- build_file_content = """
33- exports_files(["python_bin"])
34- filegroup(
35- name = "files",
36- srcs = glob(["bazel_install/**"], exclude = ["**/* *"]),
37- visibility = ["//visibility:public"],
38- )
39- """ ,
40- patch_cmds = [
41- "mkdir $(pwd)/bazel_install" ,
42- _py_configure ,
43- "make" ,
44- "make install" ,
45- "ln -s bazel_install/bin/python3 python_bin" ,
46- ],
47- sha256 = "dfab5ec723c218082fe3d5d7ae17ecbdebffa9a1aea4d64aa3a2ecdd2e795864" ,
48- strip_prefix = "Python-3.8.3" ,
49- urls = ["https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tar.xz" ],
50- )
51- # End of in-build Python interpreter setup.
52-
5316local_repository (
5417 name = "rules_python_external" ,
5518 path = "../" ,
@@ -75,7 +38,7 @@ pip_install(
7538 # 1. Python interpreter that you compile in the build file (as above in @python_interpreter).
7639 # 2. Pre-compiled python interpreter included with http_archive
7740 # 3. Wrapper script, like in the autodetecting python toolchain.
78- python_interpreter_target = "@python_interpreter//:python_bin" ,
41+ # python_interpreter_target = "@python_interpreter//:python_bin",
7942
8043 # (Optional) You can set quiet to False if you want to see pip output.
8144 #quiet = False,
@@ -84,6 +47,44 @@ pip_install(
8447 requirements = "//:requirements.txt" ,
8548)
8649
50+ # You could optionally use an in-build, compiled python interpreter as a toolchain,
51+ # and also use it to execute pip.
52+ #
53+ # Special logic for building python interpreter with OpenSSL from homebrew.
54+ # See https://devguide.python.org/setup/#macos-and-os-x
55+ #_py_configure = """
56+ #if [[ "$OSTYPE" == "darwin"* ]]; then
57+ # ./configure --prefix=$(pwd)/bazel_install --with-openssl=$(brew --prefix openssl)
58+ #else
59+ # ./configure --prefix=$(pwd)/bazel_install
60+ #fi
61+ #"""
62+ #
63+ # NOTE: you need to have the SSL headers installed to build with openssl support (and use HTTPS).
64+ # E.g. on Ubuntu: `sudo apt install libssl-dev`
65+ #http_archive(
66+ # name = "python_interpreter",
67+ # build_file_content = """
68+ #exports_files(["python_bin"])
69+ #filegroup(
70+ # name = "files",
71+ # srcs = glob(["bazel_install/**"], exclude = ["**/* *"]),
72+ # visibility = ["//visibility:public"],
73+ #)
74+ #""",
75+ # patch_cmds = [
76+ # "mkdir $(pwd)/bazel_install",
77+ # _py_configure,
78+ # "make",
79+ # "make install",
80+ # "ln -s bazel_install/bin/python3 python_bin",
81+ # ],
82+ # sha256 = "dfab5ec723c218082fe3d5d7ae17ecbdebffa9a1aea4d64aa3a2ecdd2e795864",
83+ # strip_prefix = "Python-3.8.3",
84+ # urls = ["https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tar.xz"],
85+ #)
86+
8787# Optional:
8888# Register the toolchain with the same python interpreter we used for pip in pip_install().
89- register_toolchains ("//:my_py_toolchain" )
89+ #register_toolchains("//:my_py_toolchain")
90+ # End of in-build Python interpreter setup.
0 commit comments