Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Commit

Permalink
Make it possible to overwrite skydoc attribute of skylark_doc rule.
Browse files Browse the repository at this point in the history
Minor style changes.

--
MOS_MIGRATED_REVID=121571467
  • Loading branch information
davidzchen committed May 6, 2016
1 parent cdb1113 commit 0b9313f
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions skydoc/build.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ syntax = "proto2";

package skydoc;

option py_api_version = 2;

message Attribute {
// Indicates the type of attribute.
enum Discriminator {
Expand Down
1 change: 1 addition & 0 deletions skydoc/common_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import unittest


from skydoc import common


Expand Down
1 change: 1 addition & 0 deletions skydoc/macro_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from skydoc import build_pb2
from skydoc import common


def get_type(expr):
"""Find the type of an expression.
Expand Down
1 change: 1 addition & 0 deletions skydoc/macro_extractor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.



import os
import tempfile
import textwrap
Expand Down
5 changes: 4 additions & 1 deletion skydoc/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

"""Documentation generator for Skylark"""


import gflags
import jinja2
import os
Expand Down Expand Up @@ -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'

Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions skydoc/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

"""Representations used for rendering documentation templates."""


import mistune
from skydoc import build_pb2

Expand Down
3 changes: 3 additions & 0 deletions skydoc/rule_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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."""

Expand Down
3 changes: 2 additions & 1 deletion skydoc/rule_extractor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions skydoc/stubs/attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions skylark/skylark.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 0b9313f

Please sign in to comment.