def test_command_wrapper(self): from pbs import Command, which ls = Command(which("ls")) wc = Command(which("wc")) c1 = int(wc(ls(A=True), l=True)) c2 = len(os.listdir(".")) self.assertEqual(c1, c2)
def test_command_wrapper(self): from pbs import Command, which ls = Command(which("ls")) wc = Command(which("wc")) c1 = int(wc(ls("-A1"), l=True)) c2 = len(os.listdir(".")) self.assertEqual(c1, c2)
def run_test(version): py_version = "python%s" % version py_bin = pbs.which(py_version) if py_bin: print("Testing %s" % py_version.capitalize()) p = subprocess.Popen([py_bin, "test.py"] + sys.argv[2:]) p.wait() else: print("Couldn't find %s, skipping" % py_version.capitalize())
def test_print_command(self): from pbs import ls, which actual_location = which("ls") out = str(ls) self.assertEqual(out, actual_location)
def test_command_wrapper_equivalence(self): from pbs import Command, ls, which self.assertEqual(Command(which("ls")), ls)
def test_which(self): from pbs import which, ls self.assertEqual(which("fjoawjefojawe"), None) self.assertEqual(which("ls"), str(ls))
def status(name, s): print '%s: %s' % (name, s) def remove(filename): try: os.remove(filename) except: pass proj_root = os.path.join('..', '..') llvm_path = os.path.join(proj_root, 'llvm', 'Release+Asserts', 'bin') llc = Command(os.path.join(llvm_path, 'llc')) clang = Command(os.path.join(llvm_path, 'clang++')) imagestack = Command(os.path.join(proj_root, 'ImageStack', 'bin', 'ImageStack')) cxx = None gcc_versions = [which('g++')] for gcc in gcc_versions: cxx = Command(gcc) try: cxx('--version') except: continue break if not cxx: print 'Halide requires g++ to be in the path.' sys.exit(-1) platform = sys.platform.lower() if 'linux' in platform: platform = 'linux' elif 'darwin' in platform:
# Test for ocaml 3.12.* status('Testing for OCaml 3.12.* or greater') from pbs import ocaml, ocamlbuild ver = ocaml('-version') print ver assert '3.12' in ver or '4.' in ver print '...OK!' platform = sys.platform.lower() if 'linux' in platform: try: status('Testing for g++') from pbs import which assert which('g++') print '...OK!' status('Testing for package libc6-dev-i386') assert isfile('/usr/include/x86_64-linux-gnu/gnu/stubs-32.h') print '...OK!' status('Testing for package libsexplib-camlp4-dev') assert isdir('/usr/lib/ocaml/sexplib') print '...OK!' except: print 'You appear to be missing some required packages. Try:' print 'sudo apt-get install g++ libc6-i386-dev ocaml libsexplib-camlp4-dev' sys.exit(1) if 'darwin' in platform:
__license__ = "MIT License" __url__ = "https://github.com/boisgera/zeroconf" __version__ = "1.0.0" # Python 2.7 Standard Library import atexit import pipes import re import subprocess import sys import time if sys.platform.startswith("linux"): # Third-Party Libraries import pbs as host if not host.which("avahi-browse"): raise ImportError("unable to find avahi command-line tools") elif sys.platform.startswith("win"): startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW try: process = subprocess.Popen("dns-sd", startupinfo=startupinfo) process.kill() except WindowsError: raise ImportError("unable to find dns-sd command-line tools") # Service Search # ------------------------------------------------------------------------------ def search(name=None, type=None, domain="local"): """ Search available Zeroconf services
# Test for ocaml 3.12.* status("Testing for OCaml 3.12.* or greater") from pbs import ocaml, ocamlbuild ver = ocaml("-version") print ver assert "3.12" in ver or "4." in ver print "...OK!" platform = sys.platform.lower() if "linux" in platform: try: status("Testing for g++") from pbs import which assert which("g++") print "...OK!" status("Testing for package libc6-dev-i386") assert isfile("/usr/include/x86_64-linux-gnu/gnu/stubs-32.h") print "...OK!" status("Testing for package libsexplib-camlp4-dev") assert isdir("/usr/lib/ocaml/sexplib") print "...OK!" except: print "You appear to be missing some required packages. Try:" print "sudo apt-get install g++ libc6-i386-dev ocaml libsexplib-camlp4-dev" sys.exit(1) if "darwin" in platform: