diff options
author | David Chen <dzc@google.com> | 2016-02-10 12:52:11 +0000 |
---|---|---|
committer | Dmitry Lomov <dslomov@google.com> | 2016-02-10 16:34:46 +0000 |
commit | ea02b8a51fc924755971f78e392100b50d8dc5a2 (patch) | |
tree | 54ed40e7e37fa90ce0a4e7d44fb1566e7c147176 /src/main/java/com/google/devtools/build/lib/rules/python/PythonSemantics.java | |
parent | 847a41816c08b846e09c62834f28fbbcb08d5d6d (diff) |
Add imports attribute to Bazel native Python rules to allow adding directories to PYTHONPATH.
Fixes #702
RELNOTES: Add imports attribute to native Python rules.
--
MOS_MIGRATED_REVID=114314430
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/rules/python/PythonSemantics.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/python/PythonSemantics.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/python/PythonSemantics.java b/src/main/java/com/google/devtools/build/lib/rules/python/PythonSemantics.java index abf6a88246..2168a879ce 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/python/PythonSemantics.java +++ b/src/main/java/com/google/devtools/build/lib/rules/python/PythonSemantics.java @@ -17,10 +17,13 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.analysis.Runfiles; import com.google.devtools.build.lib.analysis.RunfilesSupport; +import com.google.devtools.build.lib.collect.nestedset.NestedSet; import com.google.devtools.build.lib.rules.cpp.CcLinkParamsStore; import com.google.devtools.build.lib.rules.test.InstrumentedFilesCollector.InstrumentationSpec; +import com.google.devtools.build.lib.vfs.PathFragment; import java.util.Collection; +import java.util.List; /** * Pluggable semantics for Python rules. @@ -56,16 +59,21 @@ public interface PythonSemantics { RuleContext ruleContext, Collection<Artifact> sources, PyCommon common); /** + * Returns a list of PathFragments for the import paths specified in the imports attribute. + */ + List<PathFragment> getImports(RuleContext ruleContext); + + /** * Create the actual executable artifact. * * <p>This should create a generating action for {@code common.getExecutable()}. */ void createExecutable(RuleContext ruleContext, PyCommon common, - CcLinkParamsStore ccLinkParamsStore); + CcLinkParamsStore ccLinkParamsStore, NestedSet<PathFragment> imports); /** * Called at the end of the analysis of {@code py_binary} rules. - * @throws InterruptedException + * @throws InterruptedException */ void postInitBinary(RuleContext ruleContext, RunfilesSupport runfilesSupport, PyCommon common) throws InterruptedException; |