|
11 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 | 12 | # See the License for the specific language governing permissions and
|
13 | 13 | # limitations under the License.
|
| 14 | + |
| 15 | + |
| 16 | +# DO NOT EDIT. THIS FILE WAS AUTOGENERATED FROM templates/instrumentation_setup.py.txt. |
| 17 | +# RUN `python scripts/generate_setup.py` TO REGENERATE. |
| 18 | + |
| 19 | + |
| 20 | +import distutils.cmd |
| 21 | +import json |
14 | 22 | import os
|
| 23 | +from configparser import ConfigParser |
15 | 24 |
|
16 | 25 | import setuptools
|
17 | 26 |
|
| 27 | +config = ConfigParser() |
| 28 | +config.read("setup.cfg") |
| 29 | + |
| 30 | +# We provide extras_require parameter to setuptools.setup later which |
| 31 | +# overwrites the extra_require section from setup.cfg. To support extra_require |
| 32 | +# secion in setup.cfg, we load it here and merge it with the extra_require param. |
| 33 | +extras_require = {} |
| 34 | +if "options.extras_require" in config: |
| 35 | + for key, value in config["options.extras_require"].items(): |
| 36 | + extras_require[key] = [v for v in value.split("\n") if v.strip()] |
| 37 | + |
18 | 38 | BASE_DIR = os.path.dirname(__file__)
|
| 39 | +PACKAGE_INFO = {} |
| 40 | + |
19 | 41 | VERSION_FILENAME = os.path.join(
|
20 |
| - BASE_DIR, "src", "opentelemetry", "instrumentation", "pika", "version.py", |
| 42 | + BASE_DIR, "src", "opentelemetry", "instrumentation", "pika", "version.py" |
21 | 43 | )
|
22 |
| -PACKAGE_INFO = {} |
23 | 44 | with open(VERSION_FILENAME) as f:
|
24 | 45 | exec(f.read(), PACKAGE_INFO)
|
25 | 46 |
|
| 47 | +PACKAGE_FILENAME = os.path.join( |
| 48 | + BASE_DIR, "src", "opentelemetry", "instrumentation", "pika", "package.py" |
| 49 | +) |
| 50 | +with open(PACKAGE_FILENAME) as f: |
| 51 | + exec(f.read(), PACKAGE_INFO) |
| 52 | + |
| 53 | +# Mark any instruments/runtime dependencies as test dependencies as well. |
| 54 | +extras_require["instruments"] = PACKAGE_INFO["_instruments"] |
| 55 | +test_deps = extras_require.get("test", []) |
| 56 | +for dep in extras_require["instruments"]: |
| 57 | + test_deps.append(dep) |
| 58 | + |
| 59 | +extras_require["test"] = test_deps |
| 60 | + |
| 61 | + |
| 62 | +class JSONMetadataCommand(distutils.cmd.Command): |
| 63 | + |
| 64 | + description = ( |
| 65 | + "print out package metadata as JSON. This is used by OpenTelemetry dev scripts to ", |
| 66 | + "auto-generate code in other places", |
| 67 | + ) |
| 68 | + user_options = [] |
| 69 | + |
| 70 | + def initialize_options(self): |
| 71 | + pass |
| 72 | + |
| 73 | + def finalize_options(self): |
| 74 | + pass |
| 75 | + |
| 76 | + def run(self): |
| 77 | + metadata = { |
| 78 | + "name": config["metadata"]["name"], |
| 79 | + "version": PACKAGE_INFO["__version__"], |
| 80 | + "instruments": PACKAGE_INFO["_instruments"], |
| 81 | + } |
| 82 | + print(json.dumps(metadata)) |
| 83 | + |
| 84 | + |
26 | 85 | setuptools.setup(
|
| 86 | + cmdclass={"meta": JSONMetadataCommand}, |
27 | 87 | version=PACKAGE_INFO["__version__"],
|
28 |
| - entry_points={ |
29 |
| - "opentelemetry_instrumentor": [ |
30 |
| - "pika = opentelemetry.instrumentation.pika:PikaInstrumentor" |
31 |
| - ] |
32 |
| - }, |
| 88 | + extras_require=extras_require, |
33 | 89 | )
|
0 commit comments