daml/bazel_tools/dev_env_package/dev_env_package.py
Andreas Herrmann c11832e8a9
nodejs_dev_env: Use Bazel's repository_ctx.symlink (#2056)
Python's `os.symlink` may fail on Windows if the user has insufficient
permissions to create symbolic links. This was not noticed on CI, since
builds there are executed with administrator privileges.

This changes `dev_env_package` to only outsource the listing of
directory contents to Python, but then fall back to Bazel's own
`repository_ctx.symlink` for the creation of symbolic links (or copies
if necessary).
2019-07-09 12:39:16 +02:00

29 lines
621 B
Python
Executable File

#!/usr/bin/env python3
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
def main():
parser = argparse.ArgumentParser()
parser.add_argument("source", type=str)
args = parser.parse_args()
list_contents(args.source)
def list_contents(source_dir):
for item in os.listdir(source_dir):
if item in ["BUILD", "BUILD.bazel", "WORKSPACE"]:
# Skip nested BUILD files as they confuse Bazel.
continue
print(item)
if __name__ == "__main__":
main()