How to use the sh.glob function in sh

To help you get started, we’ve selected a few sh examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lab11 / M-ulator / ci_tests.py View on Github external
BUILD_DIR = 'builds'
PRISTINE = os.path.join(BUILD_DIR, 'simulator')


# Start from scratch
rm('-r', '-f', BUILD_DIR)
mkdir(BUILD_DIR)


# No fuse in the CI environment means we need a unique directory for each
# variant. We first grab a copy of the simulator folder and wipe out all things
# tup to use as a template so that the same script will work locally and in CI
cp('-r', 'simulator', PRISTINE)
with sh.pushd(PRISTINE):
	rm('-r', '-f', '.tup')
	rm('-r', '-f', sh.glob('build-*'))

variants = {}

log.info(sh.cc('--version'))

for variant_file in os.listdir('simulator/configs'):
	log.info("Building {}".format(variant_file))

	variant = os.path.basename(variant_file)

	build_variant_dir = os.path.join(BUILD_DIR, variant)
	mkdir(build_variant_dir)
	cp('-r', PRISTINE, build_variant_dir)

	with sh.pushd(os.path.join(build_variant_dir, 'simulator')):
		tup('init')
github bollwyvl / blockd3 / app / app.py View on Github external
sub_data=lambda x: os.path.basename(x)[0:-4],
                sub_text=lambda x: " ".join(x.split("-")).title()
            ),
            examples=dict(
                path="blockml/*.xml",
                sub_data=lambda x: os.path.basename(x)[0:-4],
                sub_text=lambda x: " ".join(x.split("_")).title()
            )
        )
        
        result = {}
        
        for thing, cfg in rt_cfg.items():
            result[thing] = sorted([
                (cfg["sub_text"](cfg["sub_data"](path)), cfg["sub_data"](path))
                for path in sh.glob(cfg["path"])
            ], key=lambda x: x[0].upper())
        return result
github bollwyvl / blockd3 / fabfile.py View on Github external
@task
def clean():
    proj()
    print ". cleaning up build and dist"
    try:
        sh.rm("-r", sh.glob("dist/*"), sh.glob("build/*"))
    except:
        print ".. already clean"
@task
github bollwyvl / blockd3 / fabfile.py View on Github external
@task
def copy_assets():
    proj()
    print(". copying assets ...")
    copy_patterns = {
        "dist/lib/blockly": ["lib/blockly/blockly.css"],
        "dist/lib/blockly/media":  sh.glob("lib/blockly/media/*") or [],
        "dist/font": sh.glob("lib/awesome/font/fontawesome-webfont.*") or [],
        "dist/lib/swatch": sh.glob("lib/swatch/*.css"),
        "dist/lib/cm/theme": sh.glob("lib/cm/theme/*.css"),
        "dist/css": [],
        "dist/js": [],
        "dist/blockml": sh.glob("blockml/*.xml") or [],
        "dist/svg": sh.glob("svg/*.svg") or [],
    }

    for dst, copy_files in copy_patterns.items():

        os.path.exists(dst) or sh.mkdir("-p", dst)
        for c_file in copy_files:
            print "... copying", c_file, dst
            sh.cp("-r", c_file, dst)
github codelv / enaml-native / python-for-ios / recipes / python / __init__.py View on Github external
sh.find(".", "-iname", "*.py", "-exec", "rm", "{}", ";")
            #sh.find(".", "-iname", "test*", "-exec", "rm", "-rf", "{}", ";")
            sh.rm("-rf", "wsgiref", "bsddb", "curses", "idlelib", "hotshot")
            sh.rm("-rf", sh.glob("lib*"))

            # now create the zip.
            print("Create a python27.zip")

            sh.rm("config/libpython2.7.a")
            sh.rm("config/python.o")
            sh.rm("config/config.c.in")
            sh.rm("config/makesetup")
            sh.rm("config/install-sh")
            sh.mv("config", "..")
            sh.mv("site-packages", "..")
            sh.zip("-r", "../python27.zip", sh.glob("*"))
            sh.rm("-rf", sh.glob("*"))
            sh.mv("../config", ".")
            sh.mv("../site-packages", ".")
        finally:
            os.chdir(oldpwd)
github bollwyvl / blockd3 / fabfile.py View on Github external
@task
def copy_assets():
    proj()
    print(". copying assets ...")
    copy_patterns = {
        "dist/lib/blockly": ["lib/blockly/blockly.css"],
        "dist/lib/blockly/media":  sh.glob("lib/blockly/media/*") or [],
        "dist/font": sh.glob("lib/awesome/font/fontawesome-webfont.*") or [],
        "dist/lib/swatch": sh.glob("lib/swatch/*.css"),
        "dist/lib/cm/theme": sh.glob("lib/cm/theme/*.css"),
        "dist/css": [],
        "dist/js": [],
        "dist/blockml": sh.glob("blockml/*.xml") or [],
        "dist/svg": sh.glob("svg/*.svg") or [],
    }

    for dst, copy_files in copy_patterns.items():

        os.path.exists(dst) or sh.mkdir("-p", dst)
        for c_file in copy_files:
            print "... copying", c_file, dst
            sh.cp("-r", c_file, dst)
github jeffersonheard / geoanalytics / ga_resources / drivers / shapefile.py View on Github external
def clear_cached_files(self):
        sh.rm('-f', sh.glob(os.path.join(self.cache_path, '*.shp')))
        sh.rm('-f', sh.glob(os.path.join(self.cache_path, '*.shx')))
        sh.rm('-f', sh.glob(os.path.join(self.cache_path, '*.dbf')))
        sh.rm('-f', sh.glob(os.path.join(self.cache_path, '*.prj')))
github kivy / kivy-ios / recipes / numpy / __init__.py View on Github external
def build_arch(self, arch):
        super(NumpyRecipe, self).build_arch(arch)
        sh.cp(sh.glob(join(self.build_dir, "build", "temp.*", "libnpy*.a")),
              self.build_dir)