Files
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
eng
libcxx
libcxxabi
libunwind
lld
lldb
cmake
docs
examples
include
lit
lldb.xcodeproj
lldb.xcworkspace
packages
resources
scripts
Python
Xcode
repos
build-llvm.py
lldbbuild.py
package-clang-headers.py
prepare-gtest-run-dir.sh
repo.py
interface
swig_bot_lib
CMakeLists.txt
analyze-project-deps.py
build-lldb-llvm-clang
buildbot.py
checkpoint-llvm.pl
disasm-gdb-remote.pl
finish-swig-wrapper-classes.sh
finishSwigWrapperClasses.py
framework-header-fix.sh
generate-vers.pl
get_relative_lib_dir.py
install-lldb.sh
install_custom_python.py
lldb.swig
prepare_bindings.py
sed-sources
shush
swig_bot.py
use_lldb_suite.py
utilsArgsParse.py
utilsDebug.py
utilsOsType.py
verify_api.py
source
third_party
tools
unittests
utils
www
.arcconfig
.clang-format
.gitignore
CMakeLists.txt
CODE_OWNERS.txt
INSTALL.txt
LICENSE.TXT
use_lldb_suite_root.py
llvm
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h

55 lines
1.9 KiB
Python
Raw Normal View History

import json
import os
import re
import shutil
import subprocess
import sys
def identifier():
try:
svn_output = subprocess.check_output(["svn", "info", "--show-item", "url"], stderr=subprocess.STDOUT).rstrip()
return svn_output
except:
pass
try:
git_remote_and_branch = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"], stderr=subprocess.STDOUT).rstrip()
git_remote = git_remote_and_branch.split("/")[0]
git_branch = "/".join(git_remote_and_branch.split("/")[1:])
git_url = subprocess.check_output(["git", "remote", "get-url", git_remote]).rstrip()
return git_url + ":" + git_branch
except:
pass
return None
def get_override():
dir = os.path.dirname(os.path.realpath(__file__))
repos_dir = os.path.join(dir, "repos")
json_regex = re.compile(r"^.*.json$")
override_path = os.path.join(repos_dir, "OVERRIDE")
if os.path.isfile(override_path):
override_set = json.load(open(override_path))
return override_set["repos"]
else:
return None
def find(identifier):
dir = os.path.dirname(os.path.realpath(__file__))
repos_dir = os.path.join(dir, "repos")
json_regex = re.compile(r"^.*.json$")
override_path = os.path.join(repos_dir, "OVERRIDE")
if os.path.isfile(override_path):
override_set = json.load(open(override_path))
return override_set["repos"]
fallback_path = os.path.join(repos_dir, "FALLBACK")
for path in [os.path.join(repos_dir, f) for f in filter(json_regex.match, os.listdir(repos_dir))]:
fd = open(path)
set = json.load(fd)
fd.close()
if any(re.match(set_regex, identifier) for set_regex in set["regexs"]):
shutil.copyfile(path, fallback_path)
return set["repos"]
if os.path.isfile(fallback_path):
fallback_set = json.load(open(fallback_path))
return fallback_set["repos"]
sys.exit("Couldn't find a branch configuration for " + identifier + " and there was no " + fallback_path)