forked from datastax/python-driver
-
Notifications
You must be signed in to change notification settings - Fork 42
/
conanfile.py
57 lines (42 loc) · 1.9 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import json
from pathlib import Path
from conan import ConanFile
from conan.tools.layout import basic_layout
from conan.internal import check_duplicated_generator
from conan.tools.files import save
CONAN_COMMANDLINE_FILENAME = "conandeps.env"
class CommandlineDeps:
def __init__(self, conanfile):
"""
:param conanfile: ``< ConanFile object >`` The current recipe object. Always use ``self``.
"""
self._conanfile = conanfile
def generate(self) -> None:
"""
Collects all dependencies and components, then, generating a Makefile
"""
check_duplicated_generator(self, self._conanfile)
host_req = self._conanfile.dependencies.host
build_req = self._conanfile.dependencies.build # tool_requires
test_req = self._conanfile.dependencies.test
content_buffer = ""
# Filter the build_requires not activated for any requirement
dependencies = [tup for tup in list(host_req.items()) + list(build_req.items()) + list(test_req.items()) if not tup[0].build]
for require, dep in dependencies:
# Require is not used at the moment, but its information could be used, and will be used in Conan 2.0
if require.build:
continue
include_dir = Path(dep.package_folder) / 'include'
package_dir = Path(dep.package_folder) / 'lib'
content_buffer += json.dumps(dict(include_dirs=str(include_dir), library_dirs=str(package_dir)))
save(self._conanfile, CONAN_COMMANDLINE_FILENAME, content_buffer)
self._conanfile.output.info(f"Generated {CONAN_COMMANDLINE_FILENAME}")
class python_driverConan(ConanFile):
win_bash = False
settings = "os", "compiler", "build_type", "arch"
requires = "libev/4.33"
def layout(self):
basic_layout(self)
def generate(self):
pc = CommandlineDeps(self)
pc.generate()