mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
c11832e8a9
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).
29 lines
621 B
Python
Executable File
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()
|
|
|