Reputation: 188
I am trying to execute a source command from package info it is building but while trying to install it I am getting the following error.
sh: 1: source: not found
ERROR: package_name/7.0@repo/stable: Error in package_info() method, line 23
self.run("source "+self.package_folder+"/pkgsdp-env.sh")
ConanException: Error 32512 while executing source /home/tusharecmc/.conan/data/pkg/7.0/repo/stable/package/4db1be536558d833e52e862fd84d64d75c2b3656/pkgsdp-env.sh
My conanfile.py is as follow
from conans import ConanFile, tools
class pkgConan(ConanFile):
name = "qnx"
version = "7.0"
settings = {"os":["Linux"],
"arch":["x86_64"]
}
description = "Package for qnx os 7.0"
url = "None"
license = "None"
author = "None"
topics = ["pkg","os"]
def package(self):
self.copy("*")
self.copy("pkgsdp-env.sh", src="./pkg700/")
def package_info(self):
self.cpp_info.libs = tools.collect_libs(self)
self.env_info.path.append(self.package_folder+"/pkg700")
self.run("source "+self.package_folder+"/pkgsdp-env.sh")
Upvotes: 1
Views: 767
Reputation: 3887
I've created Conan package for a long time and it's the first time I see someone trying to run source in a recipe. Your command will not work, because your system is using /bin/dash, that does not support the command source.
I would say to change the permission and run it directly:
qnxsdpenv = os.path.join(self.package_folder, "qnxsdp-env.sh")
permission = stat.S_IMODE(os.lstat(qnxsdpenv).st_mode)
os.chmod(qnxsdpenv, (permission | stat.S_IEXEC))
self.run(qnxsdpenv)
But if qnxsdp-env.sh only set a few env vars, I would to set them by self.env_info instead, much cleaner and readable.
Upvotes: 1