Fix generate_instrumentation_bootstrap script on windows (#527)

This commit is contained in:
Owais Lone 2021-06-03 21:19:48 +05:30 committed by GitHub
parent a3ecbc1f41
commit 9c834f0881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 6 deletions

View File

@ -18,6 +18,7 @@ import ast
import logging import logging
import os import os
import subprocess import subprocess
import sys
import astor import astor
import pkg_resources import pkg_resources
@ -91,7 +92,18 @@ def main():
with open(gen_path, "w") as gen_file: with open(gen_path, "w") as gen_file:
gen_file.write(source) gen_file.write(source)
subprocess.run(["black", "-q", gen_path], check=True) subprocess.run(
[
sys.executable,
"scripts/eachdist.py",
"format",
"--path",
"opentelemetry-instrumentation",
],
check=True,
)
logger.info("generated %s", gen_path)
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -27,12 +27,13 @@ def get_instrumentation_packages():
if not os.path.isdir(pkg_path): if not os.path.isdir(pkg_path):
continue continue
out = str( out = subprocess.check_output(
subprocess.check_output( "python setup.py meta",
"python setup.py meta", shell=True, cwd=pkg_path shell=True,
) cwd=pkg_path,
universal_newlines=True,
) )
instrumentation = json.loads(out.split("\\n")[1]) instrumentation = json.loads(out.splitlines()[1])
instrumentation["requirement"] = "==".join( instrumentation["requirement"] = "==".join(
(instrumentation["name"], instrumentation["version"],) (instrumentation["name"], instrumentation["version"],)
) )