Skip to content

Instantly share code, notes, and snippets.

@tru
Created May 23, 2017 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tru/5a0e465c9c6b20541cbe392b8ae80592 to your computer and use it in GitHub Desktop.
Save tru/5a0e465c9c6b20541cbe392b8ae80592 to your computer and use it in GitHub Desktop.
from conans.model import Generator
from conans import ConanFile
TEMPLATE="""#!/usr/bin/env python
import os, sys, subprocess
ENV={environment}
if __name__ == '__main__':
newenv = os.environ.copy()
for key, value in ENV.iteritems():
if key in newenv:
newenv[key] += + os.pathsep + os.pathsep.join(value)
else:
newenv[key] = os.pathsep.join(value)
p=subprocess.Popen(["conan"] + sys.argv[1:], env=newenv)
sys.exit(p.wait())
"""
class ConanWrap(Generator):
def __init__(self, conanfile):
self.conanfile = conanfile
self.env = conanfile.env
super(ConanWrap, self).__init__(conanfile)
@property
def filename(self):
return "conanwrap.py"
@property
def content(self):
return TEMPLATE.format(environment=self.env)
class ConanWrapGenerator(ConanFile):
name = "conanwrap"
version = "1.0"
url = "https://github.com/plexinc/plex-conan"
license = "MIT"
def build(self):
pass
def package_info(self):
self.cpp_info.includedirs = []
self.cpp_info.libdirs = []
self.cpp_info.bindirs = []
def package(self):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment