Conan : Could not find a package configuration file provided by "Protobuf" - c++

I've been trying now to install grpc (C++) via bazel and cmake.. both have failures.. BUT i thought to myself give conan a try.. but there's an error about protobuf.. so I added it to the requirements and yet it's not helping.. any ideas?
Conanfile.py
from conans import ConanFile, CMake, tools
GRPC_VERSION = "v1.48.0"
class GRPCExample(ConanFile):
name = "grpc-example"
version = GRPC_VERSION
url = "https://github.com/grpc/grpc"
description = "Built from grpcs example code in Github"
topics = ("grpc", "example")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = {"shared": False}
generators = "cmake"
requires = [("protobuf/3.21.4")]
def source(self):
self.run("git clone --depth 1 --branch " + GRPC_VERSION + " https://github.com/grpc/grpc")
def build(self):
cmake = CMake(self)
cmake.configure(source_folder="grpc/examples/cpp/helloworld")
cmake.build()
def package(self):
self.copy("*.h", dst="include", src="grpc/examples/cpp/helloworld")
self.copy("*.lib", dst="lib", keep_path=False)
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False)
self.copy("*.dylib", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["grpc-example"]
-- Found Threads: TRUE
CMake Error at /home/emcp/.conan/data/grpc-example/v1.48.0/stonks/dev/build/1df012f840559ffd3600baf4353bf1a2db1635ac/grpc/examples/cpp/cmake/common.cmake:101 (find_package):
Could not find a package configuration file provided by "Protobuf" with any
of the following names:
ProtobufConfig.cmake
protobuf-config.cmake
Add the installation prefix of "Protobuf" to CMAKE_PREFIX_PATH or set
"Protobuf_DIR" to a directory containing one of the above files. If
"Protobuf" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
CMakeLists.txt:24 (include)
-- Configuring incomplete, errors occurred!
See also "/home/emcp/.conan/data/grpc-example/v1.48.0/stonks/dev/build/1df012f840559ffd3600baf4353bf1a2db1635ac/CMakeFiles/CMakeOutput.log".
grpc-example/v1.48.0#stonks/dev:
grpc-example/v1.48.0#stonks/dev: ERROR: Package '1df012f840559ffd3600baf4353bf1a2db1635ac' build failed
grpc-example/v1.48.0#stonks/dev: WARN: Build folder /home/emcp/.conan/data/grpc-example/v1.48.0/stonks/dev/build/1df012f840559ffd3600baf4353bf1a2db1635ac
ERROR: grpc-example/v1.48.0#stonks/dev: Error in build() method, line 25
cmake.configure(source_folder="grpc/examples/cpp/helloworld")
ConanException: Error 1 while executing cd '/home/emcp/.conan/data/grpc-example/v1.48.0/stonks/dev/build/1df012f840559ffd3600baf4353bf1a2db1635ac' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="11" -DCONAN_CXX_FLAGS="-m64" -DCONAN_SHARED_LINKER_FLAGS="-m64" -DCONAN_C_FLAGS="-m64" -DCONAN_LIBCXX="libstdc++11" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="/home/emcp/.conan/data/grpc-example/v1.48.0/stonks/dev/package/1df012f840559ffd3600baf4353bf1a2db1635ac" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DCONAN_EXPORTED="1" -Wno-dev '/home/emcp/.conan/data/grpc-example/v1.48.0/stonks/dev/build/1df012f840559ffd3600baf4353bf1a2db1635ac/grpc/examples/cpp/helloworld'

Related

Conan not respecting compiler.libcxx abi setting

I have the following conan profile:
$ conan profile show default
Configuration for profile default:
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=11
compiler.cppstd=20
compiler.libcxx=libstdc++
build_type=Release
[options]
[conf]
[build_requires]
[env]
Note that compiler.libcxx is the old ABI (libstdc++) and not the new ABI (libstdc++11). This is intentional. Also I'm specifying cppstd=20.
I then made a custom conanfile for {fmt}, which tries to package up fmt 9.0. That looks like, in its entirety:
from conans import ConanFile, CMake, tools
from conan.tools.cmake import CMakeToolchain, cmake_layout
class ConanFmt(ConanFile):
name = "fmt"
version = "9.0.0"
settings = "os", "compiler", "cppstd", "build_type", "arch"
def source(self):
git = tools.Git(folder="fmt")
git.clone("https://github.com/fmtlib/fmt.git", "9.0.0", shallow=True)
def layout(self):
cmake_layout(self)
def generate(self):
tc = CMakeToolchain(self)
tc.generate()
def build(self):
cmake = CMake(self)
cmake.definitions["FMT_DOC"] = False
cmake.definitions["FMT_TEST"] = False
cmake.definitions["FMT_INSTALL"] = True
cmake.definitions["CMAKE_EXPORT_COMPILE_COMMANDS"] = True
cmake.configure(source_folder="fmt")
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ["fmt"]
When I try to go ahead and package this up, like say:
$ conan create . demo/testing -s build_type=Release
This does actually go ahead and clone the {fmt} repo, and correctly build and package up the contents of the library.
Except that:
there is no _GLIBCXX_USE_CXX11_ABI definition set (despite what this page) says.
{fmt} was compiled with C++11, not C++20
... but it was built with Release (-O3 -DNDEBUG)
Conan does appear to provide variables like CONAN_CMAKE_CXX_STANDARD=20, CONAN_STD_CXX_FLAG=-std=c++2a, and CONAN_LIBCXX=libstdc++. But {fmt}'s build doesn't actually use those, so that isn't very useful.
How do I actually get conan to propagate through these fields properly? Is that something that must be explicitly specified in the conanfile.py (even if it's in the profile)?

Converting a gcc command to conan / cmake based build [duplicate]

This question already has answers here:
How to link to the C math library with CMake?
(3 answers)
How do I add a linker or compile flag in a CMake file?
(7 answers)
Closed 9 months ago.
I am using the modern conan method for compiling. I am cross compiling an application and am trying to figure out how to convert my existing gcc command to conan / cmake solution.
Here is the gcc command:
arm-linux-gnueabihf-gcc -Wall -static -o sctc sctc.cpp -lm -lstdc++
Pretty simple.
I have successfully built the application using conan/cmake. However it is not running, I think because I am unable to invoke add the options:
-static
-lm
-lstdc++
I think. Also, would like to know how to add -Wall.
How are people debugging the command lines? Any docs or blogs about it?
Here is the conanfile.py
from conans import ConanFile, tools
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps
import os
class SctsConan(ConanFile):
name = "sctc"
version = "1.0.0"
license = "<Put the package license here>"
author = "<Put your name here> <And your email here>"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
generators = "compiler_args"
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def requirements(self):
self.requires("fff/1.1")
self.requires("gtest/cci.20210126")
def generate(self):
tc = CMakeToolchain(self)
tc.generate()
deps = CMakeDeps(self)
deps.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package_info(self):
self.cpp_info.libs = ["sctc"]
Here is the profile
[settings]
os=Linux
compiler=gcc
compiler.version=9.4
compiler.libcxx=libstdc++11
build_type=Release
arch=armv6
[env]
CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++-9
Here is the CMakeFile.txt
cmake_minimum_required(VERSION 3.14)
project(sctc)
add_executable(sctc sctc.cpp )
Any pointers to documentation are welcome. I tried searching for answers but was not able to find anything that I thought relevant. I am new to conan and cmake but am enjoying working with both.
Cheers,
Dave

Conan with cmake-conan missing conanbuild.conf

I am want to package a CMake project with conan.
For that I use the following conanfile.py:
import os
from conans import ConanFile, tools
from conan.tools.cmake import CMake, CMakeToolchain
from conans.tools import Version
class BaseLibrary(ConanFile):
name = "base-library"
version = "1.0.0"
description = """This is a test project with a library base::io
and base::math and an executable cli."""
license = "MIT"
generators = "cmake_find_package_multi", "cmake_find_package",
default_options = {"fmt:shared": True}
build_policy = "missing" # if this package is build by default if missing.
settings = "os", "compiler", "build_type", "arch"
exports_sources = "*"
_cmake = None
def requirements(self):
if Version(self.version) >= "1.0.0":
self.requires("fmt/8.0.1")
def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
self._cmake.configure(source_folder=".")
return self._cmake
def build(self):
cmake = self._configure_cmake()
cmake.build()
cmake.install()
def package(self):
cmake = self._configure_cmake()
cmake.install()
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
tools.rmdir(os.path.join(self.package_folder, "share"))
def package_info(self):
self.cpp_info.names["cmake_find_package"] = "base"
self.cpp_info.names["cmake_find_package_multi"] = "base"
self.cpp_info.names["pkg_config"] = "base"
which is next to my main CMakeLists.txt file. The CMake project builds without problems and also has a proper install target which installs everything properly: bin,lib,include,share. In CMake I use the conan-cmake module with basically something like this.
When I run
conan create -s build_type=Release . demo/testing
I get the following weird error:
...
Requirements
base-library/1.0.0#demo/testing from local cache - Cache
fmt/8.0.1 from 'conancenter' - Cache
Packages
base-library/1.0.0#demo/testing:4f2b14d304ab8e4391d162a6eb44110cc27a3faa - Build
fmt/8.0.1:d4e9c4f02b4f03edf5a640dcd22779727d782e79 - Cache
Installing (downloading, building) binaries...
fmt/8.0.1: Already installed!
base-library/1.0.0#demo/testing: WARN: Build folder is dirty, removing it: /home/developer/.conan/data/base-library/1.0.0/demo/testing/build/4f2b14d304ab8e4391d162a6eb44110cc27a3faa
base-library/1.0.0#demo/testing: Configuring sources in /home/developer/.conan/data/base-library/1.0.0/demo/testing/source
base-library/1.0.0#demo/testing: Copying sources to build folder
base-library/1.0.0#demo/testing: Building your package in /home/developer/.conan/data/base-library/1.0.0/demo/testing/build/4f2b14d304ab8e4391d162a6eb44110cc27a3faa
base-library/1.0.0#demo/testing: Generator cmake_find_package created Findfmt.cmake
base-library/1.0.0#demo/testing: Generator cmake_find_package_multi created fmt-config-version.cmake
base-library/1.0.0#demo/testing: Generator cmake_find_package_multi created fmt-config.cmake
base-library/1.0.0#demo/testing: Generator cmake_find_package_multi created fmtTargets.cmake
base-library/1.0.0#demo/testing: Generator cmake_find_package_multi created fmtTarget-release.cmake
base-library/1.0.0#demo/testing: Aggregating env generators
base-library/1.0.0#demo/testing: Calling build()
base-library/1.0.0#demo/testing:
base-library/1.0.0#demo/testing: ERROR: Package '4f2b14d304ab8e4391d162a6eb44110cc27a3faa' build failed
base-library/1.0.0#demo/testing: WARN: Build folder /home/developer/.conan/data/base-library/1.0.0/demo/testing/build/4f2b14d304ab8e4391d162a6eb44110cc27a3faa
ERROR: base-library/1.0.0#demo/testing: Error in build() method, line 74
cmake = self._configure_cmake()
while calling '_configure_cmake', line 65
self._cmake = CMake(self)
ConanException: The file /home/developer/.conan/data/base-library/1.0.0/demo/testing/build/4f2b14d304ab8e4391d162a6eb44110cc27a3faa/conanbuild.conf does not exist. Please, make sure that it was not generated in another folder.
What is the problem here and how can I resolve this? I could not find anything related to this?
from conans import ConanFile, CMake
...
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
...
I had the same problem and finally found the issue:
The CMake you are importing is the one working with the CMakeToolchain which are both part of the conan.tools.cmake module.
The one that is described in the usage of cmake_find_package[ref] is the one in conans module
So replacing:
from conans import ConanFile, tools
from conan.tools.cmake import CMake, CMakeToolchain
by
from conans import ConanFile, tools, CMake
from conan.tools.cmake import CMakeToolchain
should fix your problem

Pass numpy's include dir to Cmake from Setuptools

I have a C++ library which I have successfully exposed to python using Pybind11.
In the CmakeLists.txt file, I have added the numpy include like this:
include_directories("C:\\Python37\\Lib\\site-packages\\numpy\\core\\include")
This works, but is undesirable. I would like to pass the numpy include directory from my setup.py file.
My setup.py file looks very much like this one:
import os
import re
import sys
import sysconfig
import platform
import subprocess
from distutils.version import LooseVersion
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
class CMakeExtension(Extension):
def __init__(self, name, sourcedir=''):
Extension.__init__(self, name, sources=[])
self.sourcedir = os.path.abspath(sourcedir)
class CMakeBuild(build_ext):
def run(self):
try:
out = subprocess.check_output(['cmake', '--version'])
except OSError:
raise RuntimeError(
"CMake must be installed to build the following extensions: " +
", ".join(e.name for e in self.extensions))
if platform.system() == "Windows":
cmake_version = LooseVersion(re.search(r'version\s*([\d.]+)',
out.decode()).group(1))
if cmake_version < '3.1.0':
raise RuntimeError("CMake >= 3.1.0 is required on Windows")
for ext in self.extensions:
self.build_extension(ext)
def build_extension(self, ext):
extdir = os.path.abspath(
os.path.dirname(self.get_ext_fullpath(ext.name)))
cmake_args = ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=' + extdir,
'-DPYTHON_EXECUTABLE=' + sys.executable]
cfg = 'Debug' if self.debug else 'Release'
build_args = ['--config', cfg]
if platform.system() == "Windows":
cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(
cfg.upper(),
extdir)]
if sys.maxsize > 2**32:
cmake_args += ['-A', 'x64']
build_args += ['--', '/m']
else:
cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg]
build_args += ['--', '-j2']
env = os.environ.copy()
env['CXXFLAGS'] = '{} -DVERSION_INFO=\\"{}\\"'.format(
env.get('CXXFLAGS', ''),
self.distribution.get_version())
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
subprocess.check_call(['cmake', ext.sourcedir] + cmake_args,
cwd=self.build_temp, env=env)
subprocess.check_call(['cmake', '--build', '.'] + build_args,
cwd=self.build_temp)
print() # Add an empty line for cleaner output
setup(
name='python_cpp_example',
version='0.1',
author='Benjamin Jack',
author_email='benjamin.r.jack#gmail.com',
description='A hybrid Python/C++ test project',
long_description='',
# add extension module
ext_modules=[CMakeExtension('python_cpp_example')],
# add custom build_ext command
cmdclass=dict(build_ext=CMakeBuild),
zip_safe=False,
)
After having a look at some SO questions like this, I know that you can get the numpy include directory with numpy.get_include().
However, adding the include directory to the path inside the function build_extension with this line ext.include_dirs.append(numpy.get_include()) seems to have no effect.
I'd like to know how to pass the include directory properly.
Is your cmake build using the wrong numpy path or not finding numpy at all? If it's the wrong path, you could try prepending instead of appending numpy.get_include():
ext.include_dirs.insert(0,numpy.get_include())

Error deploying on Heroku (ReportLab)

I want to deploy a python / django application on Heroku. In the local environment everything works fine. I use pip to install packages. My requirements.txt is the following:
Django==1.6.2
Pillow==2.4.0
dj-database-url==0.3.0
dj-static==0.0.5
django-ckeditor-updated==4.2.8
django-toolbelt==0.0.1
gunicorn==18.0
html5lib==1.0b3
mongoengine==0.8.7
psycopg2==2.5.2
pyPdf==1.13
pymongo==2.7
pystache==0.5.3
reportlab==3.1.8
six==1.6.1
static==1.0.2
wsgiref==0.1.2
xhtml2pdf==0.0.5
But when deploying on Heroku with the command "git push heroku master" I get the error on "ReportLab" installation:
gcc -pthread -shared build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/_renderPM.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/gt1/gt1-parset1.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/gt1/gt1-dict.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/gt1/gt1-namecontext.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/gt1/gt1-region.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_vpath_bpath.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_rgb_pixbuf_affine.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_rgb_svp.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_svp.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_svp_vpath.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_svp_vpath_stroke.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_svp_ops.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_vpath.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_vpath_dash.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_affine.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_rect.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_rgb_affine.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_rgb_affine_private.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_rgb.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_rgb_rgba_affine.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_svp_intersect.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_svp_render_aa.o build/temp.linux-x86_64-2.7/tmp/pip_build_u4591/reportlab/src/rl_addons/renderPM/libart_lgpl/art_misc.o -L/usr/local/lib -L/usr/lib -L/app/.heroku/python/lib -L/app/.heroku/python/lib -lfreetype -lpython2.7 -o build/lib.linux-x86_64-2.7/reportlab/graphics/_renderPM.so
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /app/.heroku/python/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_u4591/reportlab/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-F4RTRK-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_u4591/reportlab
Traceback (most recent call last):
File "/app/.heroku/python/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/__init__.py", line 185, in main
return command.main(cmd_args)
File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 38: ordinal not in range(128)
! Push rejected, failed to compile Python app
To git#heroku.com:mysterious-oasis-7382.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:mysterious-oasis-7382.git'
Jeromes-MacBook-Pro:diagnosystem_proj Jerome$
Your help is appreciated to resolve this issue.
The problem seems to be caused by the presence of a static Python 2.7 library in /usr/local/lib/libpython2.7.a ; to install Reportlab on Heroku correctly using the python-2.7.7 runtime, I changed the order of the directories enumerated by the __call__ function in the inc_lib_dirs class of Reportlab's setup.py file as follows:
Original:
class inc_lib_dirs:
L = None
I = None
def __call__(self):
if self.L is None:
L = []
I = []
if platform == "cygwin":
aDir(L, os.path.join("/usr/lib", "python%s" % sys.version[:3], "config"))
elif platform == "darwin":
# attempt to make sure we pick freetype2 over other versions
aDir(I, "/sw/include/freetype2")
aDir(I, "/sw/lib/freetype2/include")
# fink installation directories
aDir(L, "/sw/lib")
aDir(I, "/sw/include")
# darwin ports installation directories
aDir(L, "/opt/local/lib")
aDir(I, "/opt/local/include")
aDir(I, "/usr/local/include")
aDir(L, "/usr/local/lib")
aDir(I, "/usr/include")
aDir(L, "/usr/lib")
aDir(I, "/usr/include/freetype2")
prefix = sysconfig.get_config_var("prefix")
if prefix:
aDir(L, pjoin(prefix, "lib"))
aDir(I, pjoin(prefix, "include"))
self.L=L
self.I=I
return self.I,self.L
inc_lib_dirs=inc_lib_dirs()
Edited:
class inc_lib_dirs:
L = None
I = None
def __call__(self):
if self.L is None:
L = []
I = []
if platform == "cygwin":
aDir(L, os.path.join("/usr/lib", "python%s" % sys.version[:3], "config"))
elif platform == "darwin":
# attempt to make sure we pick freetype2 over other versions
aDir(I, "/sw/include/freetype2")
aDir(I, "/sw/lib/freetype2/include")
# fink installation directories
aDir(L, "/sw/lib")
aDir(I, "/sw/include")
# darwin ports installation directories
aDir(L, "/opt/local/lib")
aDir(I, "/opt/local/include")
prefix = sysconfig.get_config_var("prefix")
if prefix:
aDir(L, pjoin(prefix, "lib"))
aDir(I, pjoin(prefix, "include"))
aDir(I, "/usr/local/include")
aDir(L, "/usr/local/lib")
aDir(I, "/usr/include")
aDir(L, "/usr/lib")
aDir(I, "/usr/include/freetype2")
self.L=L
self.I=I
return self.I,self.L
inc_lib_dirs=inc_lib_dirs()
I'd love to find a cleaner solution to avoid keeping a modified version in my egg repository.