Skip to content

Commit

Permalink
Workaround bazel-contrib#39
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Lam <[email protected]>
  • Loading branch information
lamcw committed Sep 1, 2022
1 parent ad1d482 commit 125ce9d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
22 changes: 11 additions & 11 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
# load("@buildifier_prebuilt//:rules.bzl", "buildifier")

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

buildifier(
name = "buildifier.check",
lint_mode = "warn",
mode = "diff",
)
# buildifier(
# name = "buildifier.check",
# lint_mode = "warn",
# mode = "diff",
# )

buildifier(
name = "buildifier",
lint_mode = "fix",
mode = "fix",
)
# buildifier(
# name = "buildifier",
# lint_mode = "fix",
# mode = "fix",
# )

licenses(["notice"]) # MIT

Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ mypy_integration_deps("//:current_mypy_version.txt")

http_archive(
name = "buildifier_prebuilt",
sha256 = "0450069a99db3d414eff738dd8ad4c0969928af13dc8614adbd1c603a835caad",
strip_prefix = "buildifier-prebuilt-0.4.0",
sha256 = "b3fd85ae7e45c2f36bce52cfdbdb6c20261761ea5928d1686edc8873b0d0dad0",
strip_prefix = "buildifier-prebuilt-5.1.0",
urls = [
"http://github.com/keith/buildifier-prebuilt/archive/0.4.0.tar.gz",
"https://github.com/keith/buildifier-prebuilt/archive/5.1.0.tar.gz",
],
)

Expand Down
2 changes: 2 additions & 0 deletions mypy/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ py_binary(
visibility = ["//visibility:public"],
deps = [
requirement("mypy"),
requirement("boto3-stubs"),
requirement("botocore-stubs"),
],
)
10 changes: 10 additions & 0 deletions mypy/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@


import sys
import mypy.modulefinder
from mypy.main import main

if __name__ == '__main__':
additional_package_paths = [p for p in sys.path if 'pypi__' in p]
original_get_site_packages_dirs = mypy.modulefinder.get_site_packages_dirs

def get_site_packages_dirs(*args, **kwargs):
egg_dirs, site_packages = original_get_site_packages_dirs(*args, **kwargs)
site_packages += tuple(additional_package_paths)
return egg_dirs, site_packages

mypy.modulefinder.get_site_packages_dirs = get_site_packages_dirs
main(None, sys.stdout, sys.stderr)

0 comments on commit 125ce9d

Please sign in to comment.