diff --git a/skydoc/build.proto b/skydoc/build.proto index 0a7fe44..6575eaa 100644 --- a/skydoc/build.proto +++ b/skydoc/build.proto @@ -16,6 +16,8 @@ syntax = "proto2"; package skydoc; +option py_api_version = 2; + message Attribute { // Indicates the type of attribute. enum Discriminator { diff --git a/skydoc/common_test.py b/skydoc/common_test.py index 8e8e25d..9d8cd9d 100644 --- a/skydoc/common_test.py +++ b/skydoc/common_test.py @@ -14,6 +14,7 @@ import unittest + from skydoc import common diff --git a/skydoc/macro_extractor.py b/skydoc/macro_extractor.py index 4269d42..08f2743 100644 --- a/skydoc/macro_extractor.py +++ b/skydoc/macro_extractor.py @@ -19,6 +19,7 @@ from skydoc import build_pb2 from skydoc import common + def get_type(expr): """Find the type of an expression. diff --git a/skydoc/macro_extractor_test.py b/skydoc/macro_extractor_test.py index 79b3d95..bee9e89 100644 --- a/skydoc/macro_extractor_test.py +++ b/skydoc/macro_extractor_test.py @@ -13,6 +13,7 @@ # limitations under the License. + import os import tempfile import textwrap diff --git a/skydoc/main.py b/skydoc/main.py index bce2e64..511bded 100755 --- a/skydoc/main.py +++ b/skydoc/main.py @@ -14,6 +14,7 @@ """Documentation generator for Skylark""" + import gflags import jinja2 import os @@ -46,8 +47,10 @@ DEFAULT_OUTPUT_DIR = '.' DEFAULT_OUTPUT_FILE = 'skydoc.zip' +WORKSPACE_DIR = 'io_bazel_skydoc' TEMPLATE_PATH = 'skydoc/templates' CSS_PATH = 'skydoc/sass' + CSS_FILE = 'main.css' CSS_DIR = 'css' @@ -87,7 +90,7 @@ def _runfile_path(path): break raise AssertionError('Cannot find .runfiles directory.') - return os.path.join(runfiles_dir, 'io_bazel_skydoc', path) + return os.path.join(runfiles_dir, WORKSPACE_DIR, path) def merge_languages(macro_language, rule_language): for rule in rule_language.rule: diff --git a/skydoc/rule.py b/skydoc/rule.py index 5ac2114..b7b7657 100644 --- a/skydoc/rule.py +++ b/skydoc/rule.py @@ -14,6 +14,7 @@ """Representations used for rendering documentation templates.""" + import mistune from skydoc import build_pb2 diff --git a/skydoc/rule_extractor.py b/skydoc/rule_extractor.py index 65c6600..776ee8f 100644 --- a/skydoc/rule_extractor.py +++ b/skydoc/rule_extractor.py @@ -16,11 +16,13 @@ import ast + from skydoc import build_pb2 from skydoc import common from skydoc.stubs import attr from skydoc.stubs import skylark_globals + SKYLARK_STUBS = { "attr": attr, "aspect": skylark_globals.aspect, @@ -38,6 +40,7 @@ } """Stubs for Skylark globals to be used to evaluate the .bzl file.""" + class RuleDocExtractor(object): """Extracts documentation for rules from a .bzl file.""" diff --git a/skydoc/rule_extractor_test.py b/skydoc/rule_extractor_test.py index 6264509..b8a093b 100644 --- a/skydoc/rule_extractor_test.py +++ b/skydoc/rule_extractor_test.py @@ -12,11 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import unittest + import os import tempfile import textwrap +import unittest from google.protobuf import text_format from skydoc import build_pb2 from skydoc import rule_extractor diff --git a/skydoc/stubs/attr.py b/skydoc/stubs/attr.py index faa49ad..3912d97 100644 --- a/skydoc/stubs/attr.py +++ b/skydoc/stubs/attr.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. + from skydoc import build_pb2 def strcmp(s1, s2): diff --git a/skylark/skylark.bzl b/skylark/skylark.bzl index 92225f6..93d1079 100644 --- a/skylark/skylark.bzl +++ b/skylark/skylark.bzl @@ -39,7 +39,7 @@ def _skylark_library_impl(ctx): transitive_bzl_files = sources) def _skydoc(ctx): - for f in ctx.files._skydoc: + for f in ctx.files.skydoc: if not f.path.endswith(".py"): return f @@ -151,7 +151,7 @@ Example: _skylark_doc_attrs = { "format": attr.string(default = "markdown"), - "_skydoc": attr.label( + "skydoc": attr.label( default = Label("//skydoc"), cfg = HOST_CFG, executable = True),