|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +# ------------------------------------------------------------------------- |
| 4 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 5 | +# Licensed under the MIT License. See License.txt in the project root for |
| 6 | +# license information. |
| 7 | +# -------------------------------------------------------------------------- |
| 8 | + |
| 9 | + |
| 10 | +import os |
| 11 | +import re |
| 12 | + |
| 13 | +from setuptools import find_packages, setup |
| 14 | + |
| 15 | +# Change the PACKAGE_NAME only to change folder and different name |
| 16 | +PACKAGE_NAME = "azure-monitor-opentelemetry-autoinstrumentation" |
| 17 | +PACKAGE_PPRINT_NAME = ( |
| 18 | + "Azure Monitor Opentelemetry Distro for Auto-Instrumentation" |
| 19 | +) |
| 20 | + |
| 21 | +# a-b-c => a/b/c |
| 22 | +package_folder_path = PACKAGE_NAME.replace("-", "/") |
| 23 | + |
| 24 | + |
| 25 | +# azure v0.x is not compatible with this package |
| 26 | +# azure v0.x used to have a __version__ attribute (newer versions don't) |
| 27 | +try: |
| 28 | + import azure |
| 29 | + |
| 30 | + try: |
| 31 | + ver = azure.__version__ |
| 32 | + raise Exception( |
| 33 | + "This package is incompatible with azure=={}. ".format(ver) |
| 34 | + + 'Uninstall it with "pip uninstall azure".' |
| 35 | + ) |
| 36 | + except AttributeError: |
| 37 | + pass |
| 38 | +except ImportError: |
| 39 | + pass |
| 40 | + |
| 41 | +# Version extraction inspired from 'requests' |
| 42 | +with open(os.path.join(package_folder_path, "_version.py"), "r") as fd: |
| 43 | + version = re.search( |
| 44 | + r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE |
| 45 | + ).group(1) |
| 46 | + |
| 47 | +if not version: |
| 48 | + raise RuntimeError("Cannot find version information") |
| 49 | + |
| 50 | +setup( |
| 51 | + name=PACKAGE_NAME, |
| 52 | + version=version, |
| 53 | + description="Microsoft {} Client Library for Python".format( |
| 54 | + PACKAGE_PPRINT_NAME |
| 55 | + ), |
| 56 | + long_description=open("README.md", "r").read(), |
| 57 | + long_description_content_type="text/markdown", |
| 58 | + license="MIT License", |
| 59 | + author="Microsoft Corporation", |
| 60 | + |
| 61 | + url="https://github.com/microsoft/ApplicationInsights-Python/tree/main/azure-monitor-opentelemetry", |
| 62 | + classifiers=[ |
| 63 | + "Development Status :: 4 - Beta", |
| 64 | + "Programming Language :: Python", |
| 65 | + "Programming Language :: Python :: 3", |
| 66 | + "Programming Language :: Python :: 3.7", |
| 67 | + "Programming Language :: Python :: 3.8", |
| 68 | + "Programming Language :: Python :: 3.9", |
| 69 | + "Programming Language :: Python :: 3.10", |
| 70 | + "Programming Language :: Python :: 3.11", |
| 71 | + "License :: OSI Approved :: MIT License", |
| 72 | + ], |
| 73 | + zip_safe=False, |
| 74 | + packages=find_packages( |
| 75 | + exclude=[ |
| 76 | + "tests", |
| 77 | + "samples", |
| 78 | + # Exclude packages that will be covered by PEP420 or nspkg |
| 79 | + "azure", |
| 80 | + "azure.monitor", |
| 81 | + "azure.monitor.opentelemetry", |
| 82 | + ] |
| 83 | + ), |
| 84 | + include_package_data=True, |
| 85 | + package_data={ |
| 86 | + "pytyped": ["py.typed"], |
| 87 | + }, |
| 88 | + python_requires=">=3.7", |
| 89 | + install_requires=[ |
| 90 | + "azure-monitor-opentelemetry>=1.0.0b12", |
| 91 | + ], |
| 92 | + entry_points={ |
| 93 | + "opentelemetry_distro": [ |
| 94 | + "azure_monitor_opentelemetry_distro = azure.monitor.opentelemetry.autoinstrumentation._distro:AzureMonitorDistro" |
| 95 | + ], |
| 96 | + "opentelemetry_configurator": [ |
| 97 | + "azure_monitor_opentelemetry_configurator = azure.monitor.opentelemetry.autoinstrumentation._configurator:AzureMonitorConfigurator" |
| 98 | + ], |
| 99 | + }, |
| 100 | +) |
0 commit comments