def package_info(self): # PCL has a find script which populates variables holding include paths # and libs, but since it doesn't define a target, and re-searches for # Eigen and other dependencies, it's a little annoying to use - still, # it's available by adding the resdir (below) to the CMAKE_MODULE_DIR # # While this might break encapsulation a little, we will add the libs # to the package info such that we can simply use the conan package if # we wish. (pcl_release, pcl_major) = [int(i) for i in self.version.split('.')[:2]] pcl_version_str = f'{pcl_release}.{pcl_major}' # Add the directory with CMake.. Not sure if this is a good use of resdirs self.cpp_info.resdirs = [self.pcl_cmake_dir] # Add the real include path, the default one points to include/ but the one # we use is include/pcl-1.8 self.cpp_info.includedirs = [os.path.join('include', f'pcl-{pcl_version_str}')] # Populate the libs self.cpp_info.libs = tools.collect_libs(self) if self.options.shared and 'Windows' == self.settings.os: # Add our libs to PATH self.env_info.path.append(os.path.join(self.package_folder, 'lib')) # Populate the pkg-config environment variables with tools.pythonpath(self): from platform_helpers import adjustPath, appendPkgConfigPath self.env_info.PKG_CONFIG_PCL_PREFIX = adjustPath(self.package_folder) appendPkgConfigPath(adjustPath(os.path.join(self.package_folder, 'lib', 'pkgconfig')), self.env_info)
def run_python_tests_and_upload(self): """A method to run the python tests, and upload if this is a release.""" self.output.info("----- ** RUNNING RUN_PYTHON_TESTS_AND_UPLOAD()") with tools.pythonpath(self): # Install required packages for python testing. packages_to_install = ['numpy', 'wheel'] if not self.settings.os == "Macos": self.run(f'pip install --user {" ".join(packages_to_install)}') else: self.run(f'pip install {" ".join(packages_to_install)}') # Run python tests. path_to_python_tests = os.path.join(self.build_folder, '_package', 'tests') self.run(f'python -m unittest discover -v -p *_pyt.py -s {path_to_python_tests}', cwd=os.path.join(self.package_folder, "_package")) # Create and upload wheel to aquapi if release and windows # We are uploading to aquapi here instead of pypi because pypi doesn't accept # the type of package 'linux_x86_64 that we want to upload. They only accept # manylinux1 as the plat-tag is_release = self.env.get("RELEASE_PYTHON", 'False') == 'True' is_mac_os = self.settings.os == 'Macos' is_gcc_6 = self.settings.os == "Linux" and float(self.settings.compiler.version.value) == 6.0 is_windows_md = (self.settings.os == "Windows" and str(self.settings.compiler.runtime) == "MD") if is_release and (is_mac_os or is_gcc_6 or is_windows_md): self.upload_python_package()
def build(self): vcvars = "" bootstrap = "./bootstrap.sh" if self.settings.os == "Windows": bootstrap = "bootstrap" env = { "SDKROOT": "", "CC": "", "CXX": "", "CFLAGS": "", "CXXFLAGS": "", "LDFLAGS": "" } with tools.environment_append(env): self.run("cd boost_1_64_0 && {vcvars}{bootstrap}".format( vcvars=vcvars, bootstrap=bootstrap)) if self.settings.arch == "universal": with tools.pythonpath(self): from multibuilder import MultiBuilder self.multi_builder = MultiBuilder(self, self.ios_archs) self.multi_builder.no_chdir = True self.multi_builder.multi_build(self.real_build) return self.real_build(str(self.settings.arch))
def build(self): if self.settings.arch == "universal": with tools.pythonpath(self): from multibuilder import MultiBuilder self.builder = MultiBuilder(self, ("armv7", "arm64", "x86_64", "i386")) self.builder.multi_build(self.real_build) return self.real_build(str(self.settings.arch), "")
def build(self): cmake = CMake(self) if self.settings.compiler == 'Visual Studio' \ and self.settings.compiler.version == "12": cmake.definitions["XMS_BUILD"] = self.options.xms # CXXTest doesn't play nice with PyBind. Also, it would be nice to not # have tests in release code. Thus, if we want to run tests, we will # build a test version (without python), run the tests, and then (on # sucess) rebuild the library without tests. cmake.definitions["XMS_VERSION"] = '{}'.format(self.version) cmake.definitions["IS_PYTHON_BUILD"] = self.options.pybind cmake.definitions["BUILD_TESTING"] = self.options.testing cmake.definitions["XMSGRID_TEST_PATH"] = "test_files" cmake.definitions["PYTHON_TARGET_VERSION"] = self.env.get("PYTHON_TARGET_VERSION", "3.6") cmake.configure(source_folder=".") cmake.build() cmake.install() if self.options.testing: print("***********(0.0)*************") try: cmake.test() except ConanException: raise finally: if os.path.isfile("TEST-cxxtest.xml"): with open("TEST-cxxtest.xml", "r") as f: for line in f.readlines(): no_newline = line.strip('\n') print(no_newline) print("***********(0.0)*************") elif self.options.pybind: with tools.pythonpath(self): if not self.settings.os == "Macos": self.run('pip install --user numpy twine wheel') else: self.run('pip install numpy twine wheel') self.run('python -m unittest discover -v -p *_pyt.py -s {}/_package/tests'.format( os.path.join(self.build_folder)), cwd=os.path.join(self.package_folder, "_package")) # Create and upload wheel to PyPi if release and windows is_release = self.env.get("RELEASE_PYTHON", 'False') if is_release == 'True' and ((self.settings.os == "Macos" or self.settings.os == "Linux") or (self.settings.os == "Windows" and str(self.settings.compiler.runtime) == "MD")): devpi_url = self.env.get("AQUAPI_URL", 'NO_URL') devpi_username = self.env.get("AQUAPI_USERNAME", 'NO_USERNAME') devpi_password = self.env.get("AQUAPI_PASSWORD", 'NO_PASSWORD') self.run('devpi use {}'.format(devpi_url)) self.run('devpi login {} --password {}'.format(devpi_username, devpi_password)) plat_names = {'Windows': 'win_amd64', 'Linux': 'linux_x86_64', "Macos": 'macosx-10.6-intel'} self.run('python setup.py bdist_wheel --plat-name={} --dist-dir {}'.format( plat_names[str(self.settings.os)], os.path.join(self.build_folder, "dist")), cwd=os.path.join(self.package_folder, "_package")) self.run('devpi upload --from-dir {}'.format(os.path.join(self.build_folder, "dist")), cwd=".")
def package_info(self): self.cpp_info.libs = ['ffi'] self.env_info.MANPATH.append(os.path.join(self.package_folder, 'share', 'man')) # Populate the pkg-config environment variables with tools.pythonpath(self): from platform_helpers import adjustPath, appendPkgConfigPath self.env_info.PKG_CONFIG_LIBFFI_PREFIX = adjustPath(self.package_folder) appendPkgConfigPath(adjustPath(os.path.join(self.package_folder, 'lib', 'pkgconfig')), self.env_info)
def package_info(self): # For now, don't export the lib # self.cpp_info.libs = tools.collect_libs(self) # Populate the pkg-config environment variables with tools.pythonpath(self): # Compensate for #2644 from platform_helpers import adjustPath, appendPkgConfigPath self.env_info.PKG_CONFIG_MPFR_PREFIX = adjustPath(self.package_folder) appendPkgConfigPath(adjustPath(os.path.join(self.package_folder, 'lib', 'pkgconfig')), self.env_info)
def build(self): with tools.pythonpath(self): env_build = AutoToolsBuildEnvironment(self) with tools.environment_append(env_build.vars): vcvars = "" if self.settings.compiler == "Visual Studio": vcvars = tools.vcvars_command(self.settings) + "&&" cmake = CMake(self, cmake_system_name=(str(self.settings.os) == "Windows")) self.run('{0}cmake "{1}" {2}'.format(vcvars, self.source_folder, cmake.command_line)) self.run("{0}cmake --build . {1}".format(vcvars, cmake.build_config))
def build(self): cmake = CMake(self) if self.settings.compiler == 'Visual Studio' \ and self.settings.compiler.version == "12": cmake.definitions["XMS_BUILD"] = self.options.xms # CXXTest doesn't play nice with PyBind. Also, it would be nice to not # have tests in release code. Thus, if we want to run tests, we will # build a test version (without python), run the tests, and then (on # sucess) rebuild the library without tests. cmake.definitions["XMS_VERSION"] = '{}'.format(self.version) cmake.definitions["IS_PYTHON_BUILD"] = self.options.pybind cmake.definitions["BUILD_TESTING"] = self.options.testing cmake.definitions["XMS_TEST_PATH"] = "test_files" cmake.definitions["PYTHON_TARGET_VERSION"] = self.env.get( "PYTHON_TARGET_VERSION", "3.6") cmake.configure(source_folder=".") cmake.build() cmake.install() if self.options.testing: print("***********(0.0)*************") try: cmake.test() except ConanException: raise finally: if os.path.isfile("TEST-cxxtest.xml"): with open("TEST-cxxtest.xml", "r") as f: for line in f.readlines(): no_newline = line.strip('\n') print(no_newline) print("***********(0.0)*************") elif self.options.pybind: with tools.pythonpath(self): if not self.settings.os == "Macos": self.run('pip install --user numpy') else: self.run('pip install numpy') self.run( 'python -m unittest discover -v -p *_pyt.py -s {}/xmsinterp/python' .format(os.path.join(self.build_folder)), cwd=os.path.join(self.package_folder, "_package")) # Create and upload wheel to PyPi if release and windows is_release = self.env.get("RELEASE_PYTHON", 'False') if self.settings.os == "Windows" and is_release == 'True' and \ str(self.settings.compiler.runtime) == "MD": self.run( 'python setup.py bdist_wheel --plat-name=win_amd64 --dist-dir {}' .format(os.path.join(self.build_folder, "dist")), cwd=os.path.join(self.package_folder, "_package")) self.run('twine upload dist/*', cwd=".")
def build(self): shutil.copy("CMakeLists.txt", "Box2D-488beac0f2287ac373a72710de37d71016cd7348") if self.settings.arch == "universal": with tools.pythonpath(self): from multibuilder import MultiBuilder self.multibuilder = MultiBuilder(self, ("arm64", "x86_64")) self.multibuilder.multi_build(self.real_build) return self.real_build(str(self.settings.arch), "")
def package_info(self): self.cpp_info.libs = tools.collect_libs(self) # Populate the pkg-config environment variables with tools.pythonpath(self): from platform_helpers import adjustPath, appendPkgConfigPath self.env_info.PKG_CONFIG_FLANN_PREFIX = adjustPath(self.package_folder) appendPkgConfigPath(adjustPath(os.path.join(self.package_folder, 'lib', 'pkgconfig')), self.env_info) if tools.os_info.is_windows: # console_bridge installs the dll to the lib directory. We prefer to # see it in the bin/ directory, but because there are CMake files and # stuff, we're just going to point bin at lib for simplicity. self.cpp_info.bindirs = self.cpp_info.libdirs
def build(self): cmake = CMake(self) if self.settings.compiler == 'Visual Studio' \ and self.settings.compiler.version == "12": cmake.definitions["XMS_BUILD"] = self.options.xms # CXXTest doesn't play nice with PyBind. Also, it would be nice to not # have tests in release code. Thus, if we want to run tests, we will # build a test version (without python), run the tests, and then (on # sucess) rebuild the library without tests. cmake.definitions["XMS_VERSION"] = '{}'.format(self.version) cmake.definitions["IS_PYTHON_BUILD"] = self.options.pybind cmake.definitions["BUILD_TESTING"] = self.options.testing cmake.definitions["XMS_TEST_PATH"] = "test_files" cmake.definitions["PYTHON_TARGET_VERSION"] = self.env.get( "PYTHON_TARGET_VERSION", "3.6") cmake.configure(source_folder=".") cmake.build() cmake.install() if self.options.testing: print("***********(0.0)*************") try: cmake.test() except ConanException: raise finally: if os.path.isfile("TEST-cxxtest.xml"): with open("TEST-cxxtest.xml", "r") as f: for line in f.readlines(): no_newline = line.strip('\n') print(no_newline) print("***********(0.0)*************") elif self.options.pybind: with tools.pythonpath(self): if not self.settings.os == "Macos": self.run('pip install --user numpy') else: self.run('pip install numpy') self.run( 'python -m unittest discover -v -p *_pyt.py -s ../xmsmesh/python', cwd="./lib")
def package_info(self): self.cpp_info.libs = tools.collect_libs(self) # Populate the pkg-config environment variables with tools.pythonpath(self): from platform_helpers import adjustPath, appendPkgConfigPath pkg_config_path = os.path.join(self.package_folder, 'lib', 'pkgconfig') appendPkgConfigPath(adjustPath(pkg_config_path), self.env_info) pc_files = glob.glob( adjustPath(os.path.join(pkg_config_path, '*.pc'))) for f in pc_files: p_name = re.sub(r'\.pc$', '', os.path.basename(f)) p_name = re.sub(r'\W', '_', p_name.upper()) setattr(self.env_info, 'PKG_CONFIG_%s_PREFIX' % p_name, adjustPath(self.package_folder)) appendPkgConfigPath(adjustPath(pkg_config_path), self.env_info)
def test(self): with tools.pythonpath(self): import find_sdk_winxp self.output.info("--------Variable for SDK--------") env_winxp = find_sdk_winxp.env_dict(self.settings.arch) for key, value in env_winxp.items(): self.output.info("Key: %s" % key) self.output.info("Value: %s" % value) self.output.info("--------Append variable--------") env_vcvars = { "PATH": "C:\\Path", "LIB": "C:\\Lib", "CL": "/D_define_", "LINK": "/manifest" } env = find_sdk_winxp.dict_append(self.settings.arch, env=env_vcvars) for key, value in env.items(): self.output.info("Key: %s" % key) self.output.info("Value: %s" % value)
def package_info(self): self.cpp_info.libs = tools.collect_libs(self) self.env_info.CMAKE_PREFIX_PATH.append(os.path.join(self.package_folder, 'lib', 'cmake')) if tools.os_info.is_windows: # VLC-Qt appears to copy all of VLC's plugins to it's local bin # directory. This env var is required or else VLC cannot be # loaded. (Though, we could likely also just point to the vlc/../bin/plugins self.env_info.VLC_PLUGIN_PATH = os.path.join(self.package_folder, 'bin', 'plugins') # Populate the pkg-config environment variables with tools.pythonpath(self): from platform_helpers import adjustPath, appendPkgConfigPath pkg_config_path = os.path.join(self.package_folder, 'lib', 'pkgconfig') appendPkgConfigPath(adjustPath(pkg_config_path), self.env_info) pc_files = glob.glob(adjustPath(os.path.join(pkg_config_path, '*.pc'))) for f in pc_files: p_name = re.sub(r'\.pc$', '', os.path.basename(f)) p_name = re.sub(r'\W', '_', p_name.upper()) setattr(self.env_info, f'PKG_CONFIG_{p_name}_PREFIX', adjustPath(self.package_folder)) appendPkgConfigPath(adjustPath(pkg_config_path), self.env_info)
def build(self): with tools.pythonpath(self): from hello import hello hello()
def test(self): with tools.pythonpath(self): import cmake_config_tools # pylint: disable=F0401 cpp_info = cmake_config_tools.cmake_find_package(self, self.source_folder, "Test")
def package_info(self): libs = ['avdevice', 'avfilter', 'avformat', 'avcodec', 'swresample', 'swscale', 'avutil'] if self.options.postproc: libs.append('postproc') if self.settings.compiler == 'Visual Studio': if self.options.shared: self.cpp_info.libs = libs self.cpp_info.libdirs.append('bin') else: self.cpp_info.libs = ['lib' + lib for lib in libs] else: self.cpp_info.libs = libs if self.settings.os == "Macos": frameworks = ['CoreVideo', 'CoreMedia', 'CoreGraphics', 'CoreFoundation', 'OpenGL', 'Foundation'] if self.options.appkit: frameworks.append('AppKit') if self.options.avfoundation: frameworks.append('AVFoundation') if self.options.coreimage: frameworks.append('CoreImage') if self.options.audiotoolbox: frameworks.append('AudioToolbox') if self.options.videotoolbox: frameworks.append('VideoToolbox') if self.options.vda: frameworks.append('VideoDecodeAcceleration') if self.options.securetransport: frameworks.append('Security') for framework in frameworks: self.cpp_info.exelinkflags.append("-framework %s" % framework) self.cpp_info.sharedlinkflags = self.cpp_info.exelinkflags elif self.settings.os == "Linux": self.cpp_info.libs.extend(['dl', 'pthread']) if self.options.alsa: self.cpp_info.libs.append('asound') if self.options.jack: self.cpp_info.libs.append('jack') if self.options.pulse: self.cpp_info.libs.append('pulse') if self.options.vaapi: self.cpp_info.libs.extend(['va', 'va-drm', 'va-x11']) if self.options.vdpau: self.cpp_info.libs.extend(['vdpau', 'X11']) if self.options.xcb: self.cpp_info.libs.extend(['xcb', 'xcb-shm', 'xcb-shape', 'xcb-xfixes']) elif self.settings.os == "Windows": self.cpp_info.libs.extend(['ws2_32', 'secur32', 'shlwapi', 'strmiids', 'vfw32']) # Populate the pkg-config environment variables with tools.pythonpath(self): from platform_helpers import adjustPath, appendPkgConfigPath pkg_config_path = os.path.join(self.package_folder, 'lib', 'pkgconfig') appendPkgConfigPath(adjustPath(pkg_config_path), self.env_info) pc_files = glob.glob(adjustPath(os.path.join(pkg_config_path, '*.pc'))) for f in pc_files: p_name = re.sub(r'\.pc$', '', os.path.basename(f)) p_name = re.sub(r'\W', '_', p_name.upper()) setattr(self.env_info, f'PKG_CONFIG_{p_name}_PREFIX', adjustPath(self.package_folder)) appendPkgConfigPath(adjustPath(pkg_config_path), self.env_info)
def test(self): with tools.pythonpath(self): import mbuild env = mbuild.env.env_t() env.version() print("Success!")
def test(self): # self.conanfile_directory with tools.pythonpath(self): import poco print("Random float from POCO: %s" % poco.random_float())
def package(self): with tools.pythonpath(self): import sfml_builder sfml_builder.package_module(self, "audio")
def build(self): with tools.pythonpath(self): import sfml_builder sfml_builder.build_module(self, "audio")
def test(self): with tools.pythonpath(self): from find_windows_signtool import find_signtool signtool = find_signtool(str(self.settings.arch)) self.output.info("signtool path: %s" % signtool)
def test(self): with tools.pythonpath(self): import boost_package_tools # pylint: disable=F0401 is_header_result = boost_package_tools.is_header_only(self) self.output.info("is_header_only: " + str(is_header_result))
def source(self): with tools.pythonpath(self): import sfml_builder sfml_builder.source(self, "sfml-" + self.version)
def package_info(self): with tools.pythonpath(self): import boost_package_tools # pylint: disable=F0401 boost_package_tools.package_info(self) getattr(self, "package_info_additional", lambda: None)()
def test(self): with tools.pythonpath(self): import sfml_builder assert hasattr(sfml_builder, "source") assert hasattr(sfml_builder, "build_module") assert hasattr(sfml_builder, "package_module")