How to use the sh.mkdir 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 tonyduckles / linkpad / View on Github external
def command_db_clone(url, dbname):
    Clone an existing database from a Git repo

    Shortcut for `git clone GIT_URL $HOME/.linkpad/$DBNAME`
    if db_exists(dbname):
        sys.exit("Error: database '{}' already exists".format(dbname))
    if not os.path.isdir(LINKPAD_BASEDIR):
        sh.mkdir('-p', LINKPAD_BASEDIR)
    sh.git('clone', url, dbname, _fg=True)
    dbpath = os.path.join(LINKPAD_BASEDIR, dbname)
    if not db_exists(dbname):
        click.echo("Deleting '{}' ...".format(dbpath))
        sh.rm('-rf', dbpath)
        sys.exit("Error: url '{}' did not contain a valid Linkpad database".format(url))
    click.echo("cloned '{}'".format(dbpath))
github lab11 / eagle / scripts / View on Github external
csv = '{}.csv'.format(base)
	txt = '{}.txt'.format(base)
	if os.path.exists(csv):
	if os.path.exists(txt):
boms += converted_boms

# Get the output file name
output_name = fab_zip.split('_to_fab')[0] + '_{}.zip'.format(

# Actually make the zip

# Generate the folders we use to organize things

# Put the contents of the zip files in the folders
# This way we don't have to replicate that logic
unzip(fab_zip, '-d', FAB_FOLDER)
unzip(assem_zip, '-d', ASSEM_FOLDER)

# Put the images in the images folder
for jpg in jpgs:
	cp(jpg, IMAGE_FOLDER)

# Get the filenames for fab
fab_files = glob.glob('{}/*'.format(FAB_FOLDER))
assem_files = glob.glob('{}/*'.format(ASSEM_FOLDER))
image_files = glob.glob('{}/*'.format(IMAGE_FOLDER))
github XiaoMi / mace / tools / View on Github external
def pull(self, src_path, file_name, dst_path='.'):
        if not os.path.exists(dst_path):
            sh.mkdir("-p", dst_path)
        src_file = "%s/%s" % (src_path, file_name)
        dst_file = "%s/%s" % (dst_path, file_name)
        if os.path.exists(dst_file):
            sh.rm('-f', dst_file)
        six.print_("Pull %s to %s" % (src_file, dst_path))
        if self.system ==
                src_file, dst_file, self.address)
        elif self.system == SystemType.arm_linux:
                sh.scp('-r', '%s@%s:%s' % (self.username,
            except sh.ErrorReturnCode_1 as e:
                six.print_("Pull Failed !", file=sys.stderr)
github lbryio / lbry-android / p4a / pythonforandroid / bootstraps / webview / View on Github external
arch = self.ctx.archs[0]
        if len(self.ctx.archs) > 1:
            raise ValueError('built for more than one arch, but bootstrap cannot handle that yet')
        info('Bootstrap running with arch {}'.format(arch))

        with current_directory(self.dist_dir):
            info('Copying python distribution')

            if not exists('private') and not self.ctx.python_recipe.from_crystax:
                shprint(sh.mkdir, 'private')
            if not exists('crystax_python') and self.ctx.python_recipe.from_crystax:
                shprint(sh.mkdir, 'crystax_python')
                shprint(sh.mkdir, 'crystax_python/crystax_python')
            if not exists('assets'):
                shprint(sh.mkdir, 'assets')

            hostpython = sh.Command(self.ctx.hostpython)
            if not self.ctx.python_recipe.from_crystax:
                    shprint(hostpython, '-OO', '-m', 'compileall',
                            _tail=10, _filterout="^Listing")
                except sh.ErrorReturnCode:
                if not exists('python-install'):
                    shprint(sh.cp, '-a', self.ctx.get_python_install_dir(), './python-install')

            self.distribute_libs(arch, [self.ctx.get_libs_dir(arch.arch)])
github lbryio / lbry-android / recipes / libgmp / View on Github external
def build_arch(self, arch):
        with current_directory(self.get_build_dir(arch.arch)):
            env = self.get_recipe_env(arch)
            configure = sh.Command('./configure')
            shprint(sh.make, '-j4', _env=env)
            shprint(sh.mkdir, 'include')
            shprint(sh.cp, '-a', 'gmp.h', 'include/gmp.h')
            shprint(sh.cp, '-a', '.libs/', join(self.ctx.get_libs_dir(arch.arch), ''))
            shprint(sh.cp, '-a', '.libs/', join(self.ctx.get_libs_dir(''), '')) # also copy to libs_collections/
github XiaoMi / mace / tools / View on Github external
def gen_encrypted_opencl_source(codegen_path="mace/codegen"):
    sh.mkdir("-p", "%s/opencl" % codegen_path)
github lbryio / lbry-android / recipes / sqlite3 / View on Github external
def prebuild_arch(self, arch):
        super(Sqlite3Recipe, self).prebuild_arch(arch)
        # Copy the Android make file

        sh.mkdir('-p', join(self.get_build_dir(arch.arch), 'jni'))
        shutil.copyfile(join(self.get_recipe_dir(), ''),
                        join(self.get_build_dir(arch.arch), 'jni/'))
github yejianye / cdnjs-cli / fetchr / View on Github external
def download(url, filename):
    filedir = os.path.dirname(filename)
    sh.mkdir('-p', filedir)
    print '%s --> %s' % (url, filename)
    resp = requests.get(url)
    if resp.ok:
        f = open(filename, 'w')
        print 'Error: %s' % resp.status_code
    return resp.ok
github hpe-storage / python-hpedockerplugin / hpedockerplugin / View on Github external
def _create_mount_dir(self, mount_dir):'Creating Directory %(mount_dir)s...',
                 {'mount_dir': mount_dir})
        sh.mkdir('-p', mount_dir)'Directory: %(mount_dir)s successfully created!',
                 {'mount_dir': mount_dir})
github codelv / enaml-native-cli / python-for-android / pythonforandroid / View on Github external
def prepare_build_dir(self):
        '''Ensure that a build dir exists for the recipe. This same single
        dir will be used for building all different archs.'''
        self.build_dir = self.get_build_dir()
        shprint(sh.cp, '-r',
                join(self.bootstrap_dir, 'build'),
        if self.ctx.symlink_java_src:
            info('Symlinking java src instead of copying')
            shprint(sh.rm, '-r', join(self.build_dir, 'src'))
            shprint(sh.mkdir, join(self.build_dir, 'src'))
            for dirn in listdir(join(self.bootstrap_dir, 'build', 'src')):
                shprint(sh.ln, '-s', join(self.bootstrap_dir, 'build', 'src', dirn),
                        join(self.build_dir, 'src'))
        with current_directory(self.build_dir):
            with open('', 'w') as fileh: