Skip to content

Commit

Permalink
Add emacs-friendly headers. Address other comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
EricCousineau-TRI committed Jan 2, 2018
1 parent 09355a5 commit ae4f641
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 6 deletions.
2 changes: 2 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- python -*-

package(default_visibility = ["//visibility:public"])

alias(
Expand Down
10 changes: 8 additions & 2 deletions src/bazel_external_data/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# -*- python -*-

# Use relative package path, as `py_library` does not like absolute package
# paths. This ensures that `//src` is added to `PYTHONPATH`.
imports = [".."]

# @note 'core' has no backends present.
py_library(
name = "core",
Expand All @@ -7,7 +13,7 @@ py_library(
"util.py",
"hashes.py",
],
imports = [".."],
imports = imports,
visibility = ["//visibility:public"],
)

Expand All @@ -22,7 +28,7 @@ py_library(
":core",
"//src/bazel_external_data/backends",
],
imports = [".."],
imports = imports,
visibility = ["//visibility:public"],
)

Expand Down
4 changes: 4 additions & 0 deletions src/bazel_external_data/backends/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# -*- python -*-

# Use relative package path, as `py_library` does not like absolute package
# paths. This ensures that `//src` is added to `PYTHONPATH`.
imports = ["../.."]

py_library(
Expand Down
6 changes: 3 additions & 3 deletions src/bazel_external_data/config_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from bazel_external_data import util


def guess_start_dir(filepath):
"""Returns the directory of a file, or the directory if passed directly."""
def _resolve_dir(filepath):
# Returns the directory of a file, or the directory if passed directly.
if os.path.isdir(filepath):
return filepath
else:
Expand All @@ -37,7 +37,7 @@ def sentinel_check(filepath):
else:
return False

start_dir = guess_start_dir(guess_filepath)
start_dir = _resolve_dir(guess_filepath)
root_file = util.find_file_sentinel(start_dir, sentinel, sentinel_check)
if root_file is None:
hint = ""
Expand Down
2 changes: 1 addition & 1 deletion src/bazel_external_data/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def find_file_sentinel(start_dir, sentinel_file,
"""Finds a sentinel given a check. """
cur_dir = start_dir
assert len(cur_dir) > 0
for i in xrange(max_depth):
for _ in xrange(max_depth):
assert os.path.isdir(cur_dir)
test_path = os.path.join(cur_dir, sentinel_file)
if sentinel_check(test_path):
Expand Down
2 changes: 2 additions & 0 deletions test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- python -*-

sh_test(
name = "workflows_test",
srcs = ["workflows_test.sh"],
Expand Down
2 changes: 2 additions & 0 deletions test/bazel_pkg_advanced_test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- python -*-

filegroup(
name = "external_data_sentinel",
srcs = [":.external_data.yml"],
Expand Down
2 changes: 2 additions & 0 deletions test/bazel_pkg_advanced_test/data/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- python -*-

load("//tools:external_data.bzl",
"external_data",
"external_data_group",
Expand Down
2 changes: 2 additions & 0 deletions test/bazel_pkg_advanced_test/tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- python -*-

# Do not use user's configuration.
exports_files(
srcs = [
Expand Down
2 changes: 2 additions & 0 deletions test/bazel_pkg_downstream_test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- python -*-

py_test(
name = "test_basics",
srcs = ["test_basics.py"],
Expand Down
2 changes: 2 additions & 0 deletions test/bazel_pkg_test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- python -*-

filegroup(
name = "external_data_sentinel",
srcs = [':.external_data.yml'],
Expand Down
2 changes: 2 additions & 0 deletions test/bazel_pkg_test/data/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- python -*-

load("//tools:external_data.bzl",
"external_data",
)
Expand Down
3 changes: 3 additions & 0 deletions test/bazel_pkg_test/tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- python -*-

# Empty BUILD file to declare this directory as a package.
3 changes: 3 additions & 0 deletions tools/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- python -*-

# Empty BUILD file to declare this directory as a package.

0 comments on commit ae4f641

Please sign in to comment.