@@ -14,26 +14,27 @@ cc_library(
1414"""
1515
1616def _impl (repository_ctx ):
17- rctx = repository_ctx
18- if "/" in rctx .attr .path or "\\ " in rctx .attr .path :
19- # Canonicalize the path
20- realpath = rctx .path (rctx .attr .path )
21- else :
22- # Find it in $PATH
23- realpath = rctx .which (rctx .attr .path )
24- rctx .symlink (realpath , "bin/python" )
25- include_path = rctx .execute ([
26- realpath , "-c" , "import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())" ,
27- ])
28- if include_path .return_code != 0 :
29- fail ("Failed to locate Python headers:\n " + include_path .stderr )
30- rctx .symlink (include_path .stdout .strip (), "include" )
31- rctx .file (
32- "WORKSPACE" ,
33- 'workspace(name = "{}")\n ' .format (rctx .name ),
34- )
35- rctx .file ("BUILD" , build_file_contents )
36-
17+ rctx = repository_ctx
18+ if "/" in rctx .attr .path or "\\ " in rctx .attr .path :
19+ # Canonicalize the path
20+ realpath = rctx .path (rctx .attr .path )
21+ else :
22+ # Find it in $PATH
23+ realpath = rctx .which (rctx .attr .path )
24+ rctx .symlink (realpath , "bin/python" )
25+ include_path = rctx .execute ([
26+ realpath ,
27+ "-c" ,
28+ "import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())" ,
29+ ])
30+ if include_path .return_code != 0 :
31+ fail ("Failed to locate Python headers:\n " + include_path .stderr )
32+ rctx .symlink (include_path .stdout .strip (), "include" )
33+ rctx .file (
34+ "WORKSPACE" ,
35+ 'workspace(name = "{}")\n ' .format (rctx .name ),
36+ )
37+ rctx .file ("BUILD" , build_file_contents )
3738
3839python_headers = repository_rule (
3940 implementation = _impl ,
0 commit comments