Generate instrumentation packages setup.py files (#474)

All instrumentations packages have almost exactly same setup.py files.
This commit adds a python script that generates it from a source
template. This dramatically reduces the time and effort required to
update all instrumentation setup.py files, and also reduces chances of
making manual mistakes.
This commit is contained in:
Owais Lone
2021-04-30 05:46:41 +05:30
committed by GitHub
parent a89d7a60bb
commit cb35cc40ab
36 changed files with 323 additions and 37 deletions

View File

@ -12,21 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from os.path import dirname, join
from setuptools import setup
# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM templates/instrumentation_setup.py.txt.
# RUN `python scripts/generate_setup.py` TO REGENERATE.
import os
import setuptools
BASE_DIR = os.path.dirname(__file__)
VERSION_FILENAME = os.path.join(
BASE_DIR, "src", "opentelemetry", "instrumentation", "django", "version.py"
)
PACKAGE_INFO = {}
with open(
join(
dirname(__file__),
"src",
"opentelemetry",
"instrumentation",
"django",
"version.py",
)
) as f:
with open(VERSION_FILENAME) as f:
exec(f.read(), PACKAGE_INFO)
setup(version=PACKAGE_INFO["__version__"])
setuptools.setup(version=PACKAGE_INFO["__version__"])