mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-08-02 19:47:17 +08:00
Update tooling (#1330)
This commit is contained in:
@ -16,7 +16,9 @@
|
||||
|
||||
import logging
|
||||
import os
|
||||
from configparser import ConfigParser
|
||||
|
||||
import tomli
|
||||
import tomli_w
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger("instrumentation_metapackage_generator")
|
||||
@ -65,17 +67,17 @@ def get_instrumentation_packages():
|
||||
def main():
|
||||
dependencies = get_instrumentation_packages()
|
||||
|
||||
setup_cfg_path = os.path.join(
|
||||
root_path, "opentelemetry-contrib-instrumentations", "setup.cfg"
|
||||
pyproject_toml_path = os.path.join(
|
||||
root_path, "opentelemetry-contrib-instrumentations", "pyproject.toml"
|
||||
)
|
||||
config = ConfigParser()
|
||||
config.read(setup_cfg_path)
|
||||
|
||||
deps = "\n".join(f"{pkg}=={version}" for pkg, version in dependencies)
|
||||
deps = [f"{pkg}=={version}" for pkg, version in dependencies]
|
||||
with open(pyproject_toml_path, "rb") as file:
|
||||
pyproject_toml = tomli.load(file)
|
||||
|
||||
config["options"]["install_requires"] = "\n" + deps
|
||||
with open(setup_cfg_path, "w", encoding="utf-8") as fh:
|
||||
config.write(fh)
|
||||
pyproject_toml["project"]["dependencies"] = deps
|
||||
with open(pyproject_toml_path, "wb") as fh:
|
||||
tomli_w.dump(pyproject_toml, fh)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Reference in New Issue
Block a user