def set_python_binary(kwargs): # Use default python executable if python_version keyword is not given python_binary = executable_path("python") if "python_version" in kwargs: python_binary += kwargs["python_version"] if executable_path(python_binary) is None: raise BuiltinError("%s could not found." % python_binary) return python_binary
def git(*parameters): git_binary = utils.executable_path("git") if not os.access(git_binary, os.X_OK): raise exceptions.NotExecutable("%s is not executable." % git_binary) if not system('%s %s' % (git_binary, " ".join(parameters))): raise exceptions.CommandFailed('command failed: %s %s' % \ (git_binary, " ".join(parameters))) return True
def extract_lzma(self, path): if not utils.executable_path("tar"): lpms.terminate("please check app-arch/tar package") current = os.getcwd() os.chdir(self.location) cmd = utils.executable_path("tar") + " --lzma xvf %s" % path if path.endswith(".xz"): cmd = utils.executable_path("tar") + " Jxvf %s" % path stdout = subprocess.PIPE; stderr=subprocess.PIPE result = subprocess.Popen(cmd, shell=True, stdout=stdout, stderr=stderr) output, err = result.communicate() if result.returncode != 0: out.error("could not extract: %s" % out.color(path, "red")) print(output+err) os.chdir(current) lpms.terminate() os.chdir(current)
def extract_lzma(self, path): if not utils.executable_path("tar"): lpms.terminate("please check app-arch/tar package") current = os.getcwd() os.chdir(self.location) cmd = utils.executable_path("tar") + " --lzma xvf %s" % path if path.endswith(".xz"): cmd = utils.executable_path("tar") + " Jxvf %s" % path stdout = subprocess.PIPE stderr = subprocess.PIPE result = subprocess.Popen(cmd, shell=True, stdout=stdout, stderr=stderr) output, err = result.communicate() if result.returncode != 0: out.error("could not extract: %s" % out.color(path, "red")) print(output + err) os.chdir(current) lpms.terminate() os.chdir(current)
def __init__(self, repo, remote): self.repo = repo self.remote = remote self.git_binary = utils.executable_path("git") self.repo_path = os.path.join(cst.repos, repo)
# # You should have received a copy of the GNU General Public License # along with lpms. If not, see <http://www.gnu.org/licenses/>. import os import subprocess import lpms from lpms import out from lpms import utils from lpms import shelltools from lpms.db import api from lpms.exceptions import FileNotFound ldd_path = utils.executable_path("ldd") def remove_duplications(data): return list(set(data)) def get_depends(file_path): """Parses ldd's output and returns depends of shared lib or executable file""" depends = [] if not os.access(ldd_path, os.X_OK): out.error("%s seems problematic. please check it." % ldd_path) lpms.terminate() if not os.path.exists(file_path): raise FileNotFound("%s not found." % file_path)
# # You should have received a copy of the GNU General Public License # along with lpms. If not, see <http://www.gnu.org/licenses/>. import os import subprocess import lpms from lpms import out from lpms import utils from lpms import shelltools from lpms.db import api from lpms.exceptions import FileNotFound ldd_path = utils.executable_path("ldd") def remove_duplications(data): return list(set(data)) def get_depends(file_path): '''Parses ldd's output and returns depends of shared lib or executable file''' depends = [] if not os.access(ldd_path, os.X_OK): out.error("%s seems problematic. please check it." % ldd_path) lpms.terminate() if not os.path.exists(file_path): raise FileNotFound("%s not found." % file_path)