Build out results to dest directory (creating if needed)
350476
def build(self, dest=None):
        ""
        # dest can be set here or on init
        if not dest:
            dest = self.dest

        # raise an error if dest is None
        if dest is None:
            raise ValueError('destination directory must not be None')

        # store build dir for later
        self.dest = dest

        # ensure a build dir
        if not os.path.isdir(self.dest):
            os.makedirs(self.dest)

        # make sure we have files
        if not self.files:
            self.run()

        # write the content of each post to dest, using keys as filenames
        for filename, post in self.files.items():

            # join filename to dest dir
            path = os.path.join(self.dest, filename)
            with open(path, 'wb') as f:
                f.write(post.content.encode('utf-8'))
1005230
def prepare_output(d):
    """"""
    outDir = os.path.join(d, 'inorder')
    if not os.path.exists(outDir):
        os.mkdir(outDir)
    for f in os.listdir(outDir):
        f = os.path.join(outDir, f)
        if os.path.islink(f):
            os.remove(f)
    return outDir
507337
def generate_file(fname, ns_func, dest_dir="."):
    """"""
    with open(pjoin(root, 'buildutils', 'templates', '%s' % fname), 'r') as f:
        tpl = f.read()
    out = tpl.format(**ns_func())
    dest = pjoin(dest_dir, fname)
    info("generating %s from template" % dest)
    with open(dest, 'w') as f:
        f.write(out)
943994
def build(self, root="runs"):
        

        for d, control in self.iter(root):
            _mkdirs(d)
            with open(os.path.join(d, self.control_name), 'w') as fp:
                json.dump(control, fp, indent=self.indent)
                # RJSON and some other tools like a trailing newline
                fp.write('\n')
367402
def create(buildout_directory, buildout_extends):
    
    ##
    # Resolve arguments
    directory = get_buildout_directory(buildout_directory)
    extends = get_buildout_extends(buildout_extends)

    ##
    # 
    local('mkdir -p {0:s}'.format(directory))

    ##
    # Create buildout.cfg
    filename = os.path.join(directory, 'buildout.cfg')
    contents = """\
[buildout]
extends = {0:s}
""".format(extends)

    ##
    # Write buildout.cfg
    with NamedTemporaryFile() as output:
        print("[localhost] create: {0:s}".format(output.name))
        output.write(contents)
        output.flush()
        local('cp {0:s} {1:s}'.format(output.name, filename))
        local('chmod a+r {0:s}'.format(filename))
869445
function buildFirefox(destDir) {
  if (!destDir) {
    throw new Error('No destination directory. Either set $FIREFOX_HOME or use --location ...');
  }
  var log = 'Building Firefox outputs to ' + (destDir || 'built/ff') + '.\n\n';

  if (!destDir) {
    copy.mkdirSync(path.dirname(require.main.filename) + '/built/ff', 493 /*0755*/);
  }

  var testDir = '/browser/devtools/commandline/test';
  var propsDir = '/browser/locales/en-US/chrome/browser/devtools';

  if (destDir) {
    if (!fs.existsSync(destDir + testDir)) {
      throw new Error('Missing path for tests: ' + destDir + testDir);
    }
    if (!fs.existsSync(destDir + propsDir)) {
      throw new Error('Missing path for l10n string: ' + destDir + propsDir);
    }
  }

  // Convert GCLI test files to Mochitest files. The excluded tests are those
  // that rely on commands that ship with GCLI-web but are not implemented in
  // the same way in Firefox, and require which has been manually translated
  copy({
    source: {
      root: 'lib/gcli/test/',
      include: /test.*\.js$/,
      exclude: [
        /testHelp\.js$/,
        /testPref\.js$/,
        /testSettings\.js$/,
        /testRequire\.js$/
      ]
    },
    filter: createCommonJsToJsTestFilter(),
    filenameFilter: function(filename) {
      // the t prefix prevents 'test' from matching the directory name
      return filename.replace(/t\/test/, 't\/browser_gcli_').toLowerCase();
    },
    dest: (destDir ? destDir + testDir : 'built/ff')
  });
  copy({
    source: 'lib/gcli/test/mockCommands.js',
    filter: commonJsToJsMockFilter,
    dest: (destDir ? destDir + testDir : 'built/ff') + '/mockCommands.js'
  });
  copy({
    source: 'lib/gcli/test/mockFileCommands.js',
    filter: commonJsToJsMockFilter,
    dest: (destDir ? destDir + testDir : 'built/ff') + '/mockFileCommands.js'
  });

  // Package the i18n strings
  copy({
    source: [ 'lib/gcli/nls/strings.js' ],
    filter: tweakI18nStrings,
    dest: (destDir ? destDir + propsDir : 'built/ff') + '/gcli.properties'
  });

  return log;
}
1055293
def build(outdir):
    """"""

    print("Building your Blended files into a website!")

    reload(sys)
    sys.setdefaultencoding('utf8')

    build_files(outdir)

    print("The files are built! You can find them in the " + outdir +
          "/ directory. Run the view command to see what you have created in a web browser.")
1307530
def get_py_files(dir_name: str) -> list:
    """"""
    return flatten([
        x for x in
        [["{0}/{1}".format(path, f) for f in files if f.endswith(".py")]
         for path, _, files in os.walk(dir_name)
         if not path.startswith("./build")] if x
    ])
1021522
def build_dsc(debinfo,
              dist_dir,
              repackaged_dirname,
              orig_sdist=None,
              patch_posix=0,
              remove_expanded_source_dir=0,
              debian_dir_only=False,
              sign_dsc=False,
              ):
    """"""
    #    A. Find new dirname and delete any pre-existing contents

    # dist_dir is usually 'deb_dist'

    # the location of the copied original source package (it was
    # re-recreated in dist_dir)
    if debian_dir_only:
        fullpath_repackaged_dirname = os.path.abspath(os.curdir)
    else:
        fullpath_repackaged_dirname = os.path.join(dist_dir,repackaged_dirname)

    ###############################################
    # 1. make temporary original source tarball

    #    Note that, for the final tarball, best practices suggest
    #    using "dpkg-source -b".  See
    #    http://www.debian.org/doc/developers-reference/ch-best-pkging-practices.en.html

    # Create the name of the tarball that qualifies as the upstream
    # source. If the original was specified, we'll link to
    # it. Otherwise, we generate our own .tar.gz file from the output
    # of "python setup.py sdist" (done above) so that we avoid
    # packaging .svn directories, for example.

    if not debian_dir_only:
        repackaged_orig_tarball = ('%(source)s_%(upstream_version)s.orig.tar.gz'%
                                   debinfo.__dict__)
        repackaged_orig_tarball_path = os.path.join(dist_dir,
                                                    repackaged_orig_tarball)
        if orig_sdist is not None:
            if os.path.exists(repackaged_orig_tarball_path):
                os.unlink(repackaged_orig_tarball_path)
            link_func(orig_sdist,repackaged_orig_tarball_path)
        else:
            make_tarball(repackaged_orig_tarball,
                         repackaged_dirname,
                         cwd=dist_dir)

        # apply patch
        if debinfo.patch_file != '':
            apply_patch(debinfo.patch_file,
                        posix=patch_posix,
                        level=debinfo.patch_level,
                        cwd=fullpath_repackaged_dirname)

    for fname in ['Makefile','makefile']:
        if os.path.exists(os.path.join(fullpath_repackaged_dirname,fname)):
            sys.stderr.write('*'*1000 + '\n')
            sys.stderr.write('WARNING: a Makefile exists in this package. '
                             'stdeb will tell debhelper 7 to use setup.py '
                             'to build and install the package, and the '
                             'Makefile will be ignored.\n')
            sys.stderr.write('*'*1000 + '\n')


    ###############################################
    # 2. create debian/ directory and contents
    debian_dir = os.path.join(fullpath_repackaged_dirname,'debian')
    if not os.path.exists(debian_dir):
        os.mkdir(debian_dir)

    #    A. debian/changelog
    changelog = CHANGELOG_FILE%debinfo.__dict__
    with codecs.open( os.path.join(debian_dir,'changelog'),
                 mode='w', encoding='utf-8') as fd:
        fd.write(changelog)

    #    B. debian/control
    if debinfo.uploaders:
        debinfo.uploaders = 'Uploaders: %s\n' % ', '.join(debinfo.uploaders)
    else:
        debinfo.uploaders = ''
    control = CONTROL_FILE%debinfo.__dict__
    with codecs.open( os.path.join(debian_dir,'control'),
                      mode='w', encoding='utf-8') as fd:
        fd.write(control)

    #    C. debian/rules
    debinfo.percent_symbol = '%'
    rules = RULES_MAIN%debinfo.__dict__

    rules = rules.replace('        ','\t')
    rules_fname = os.path.join(debian_dir,'rules')
    with codecs.open( rules_fname,
                      mode='w', encoding='utf-8') as fd:
        fd.write(rules)
    os.chmod(rules_fname,0o755)

    #    D. debian/compat
    fd = open( os.path.join(debian_dir,'compat'), mode='w')
    fd.write('7\n')
    fd.close()

    #    E. debian/package.mime
    if debinfo.mime_file != '':
        if not os.path.exists(debinfo.mime_file):
            raise ValueError(
                'a MIME file was specified, but does not exist: %s'%(
                debinfo.mime_file,))
        link_func( debinfo.mime_file,
                 os.path.join(debian_dir,debinfo.package+'.mime'))
    if debinfo.shared_mime_file != '':
        if not os.path.exists(debinfo.shared_mime_file):
            raise ValueError(
                'a shared MIME file was specified, but does not exist: %s'%(
                debinfo.shared_mime_file,))
        link_func( debinfo.shared_mime_file,
                 os.path.join(debian_dir,
                              debinfo.package+'.sharedmimeinfo'))

    #    F. debian/copyright
    if debinfo.copyright_file != '':
        link_func( debinfo.copyright_file,
                 os.path.join(debian_dir,'copyright'))

    #    H. debian/<package>.install
    if len(debinfo.install_file_lines):
        fd = open( os.path.join(debian_dir,'%s.install'%debinfo.package), mode='w')
        fd.write('\n'.join(debinfo.install_file_lines)+'\n')
        fd.close()

    #    I. debian/<package>.udev
    if debinfo.udev_rules != '':
        fname = debinfo.udev_rules
        if not os.path.exists(fname):
            raise ValueError('udev rules file specified, but does not exist')
        link_func(fname,
                  os.path.join(debian_dir,'%s.udev'%debinfo.package))

    #    J. debian/source/format
    os.mkdir(os.path.join(debian_dir,'source'))
    fd = open( os.path.join(debian_dir,'source','format'), mode='w')
    fd.write('3.0 (quilt)\n')
    fd.close()

    fd = open( os.path.join(debian_dir,'source','options'), mode='w')
    fd.write('extend-diff-ignore="\.egg-info$"')
    fd.close()

    if debian_dir_only:
        return

    ###############################################
    # 3. unpack original source tarball

    debianized_package_dirname = fullpath_repackaged_dirname+'.debianized'
    if os.path.exists(debianized_package_dirname):
        raise RuntimeError('debianized_package_dirname exists: %s' %
                           debianized_package_dirname)
    #    A. move debianized tree away
    os.rename(fullpath_repackaged_dirname, debianized_package_dirname )
    if orig_sdist is not None:
        #    B. expand repackaged original tarball
        tmp_dir = os.path.join(dist_dir,'tmp-expand')
        os.mkdir(tmp_dir)
        try:
            expand_tarball(orig_sdist,cwd=tmp_dir)
            orig_tarball_top_contents = os.listdir(tmp_dir)

            # make sure original tarball has exactly one directory
            assert len(orig_tarball_top_contents)==1
            orig_dirname = orig_tarball_top_contents[0]
            fullpath_orig_dirname = os.path.join(tmp_dir,orig_dirname)

            #    C. remove original repackaged tree
            shutil.rmtree(fullpath_orig_dirname)

        finally:
            shutil.rmtree(tmp_dir)

    if 1:
        # check versions of debhelper and python-all
        debhelper_version_str = get_version_str('debhelper')
        if len(debhelper_version_str)==0:
            log.warn('This version of stdeb requires debhelper >= %s, but you '
                     'do not have debhelper installed. '
                     'Could not check compatibility.'%DH_MIN_VERS)
        else:
            if not dpkg_compare_versions(
                debhelper_version_str, 'ge', DH_MIN_VERS ):
                log.warn('This version of stdeb requires debhelper >= %s. '
                         'Use stdeb 0.3.x to generate source packages '
                         'compatible with older versions of debhelper.'%(
                    DH_MIN_VERS,))

        python_defaults_version_str = get_version_str('python-all')
        if len(python_defaults_version_str)==0:
            log.warn('This version of stdeb requires python-all >= %s, '
                     'but you do not have this package installed. '
                     'Could not check compatibility.'%PYTHON_ALL_MIN_VERS)
        else:
            if not dpkg_compare_versions(
                python_defaults_version_str, 'ge', PYTHON_ALL_MIN_VERS):
                log.warn('This version of stdeb requires python-all >= %s. '
                         'Use stdeb 0.6.0 or older to generate source packages '
                         'that use python-support.'%(
                    PYTHON_ALL_MIN_VERS,))

    #    D. restore debianized tree
    os.rename(fullpath_repackaged_dirname+'.debianized',
              fullpath_repackaged_dirname)

    #    Re-generate tarball using best practices see
    #    http://www.debian.org/doc/developers-reference/ch-best-pkging-practices.en.html

    if sign_dsc:
        args = ()
    else:
        args = ('-uc','-us')

    dpkg_buildpackage('-S','-sa',*args,cwd=fullpath_repackaged_dirname)

    if 1:
        shutil.rmtree(fullpath_repackaged_dirname)

    if not remove_expanded_source_dir:
        # expand the debian source package
        dsc_name = debinfo.source + '_' + debinfo.dsc_version + '.dsc'
        dpkg_source('-x',dsc_name,
                    cwd=dist_dir)
96745
def build(self, input_path, output_paths):
        """"""
        for output in output_paths:
            shutil.copy(input_path, output_paths)
1303188
def build(self):
        """"""

        if not self.embed:
            mkdir_recursive(self.output_directory)

        # get list of script files in build order
        self.build_order = remove_dups(
            reduce(lambda a, b: a + glob.glob(b),
                   self.build_targets,
                   []))
        self.build_order_output = [self.out_path_of(t)
                                   for (t) in self.build_order]
        self.path_mapping = dict(zip(
            self.build_order,
            self.build_order_output))

        self.compiled_scripts = {}
        exceptions, values = partition(
            lambda x: isinstance(x, Exception),
            [self.compile_and_process(target)
             for target in self.build_order])

        self.compiled_scripts.update(dict(values))

        saneExceptions, insaneExceptions = partition(
            lambda x: isinstance(x, TaskExecutionException),
            exceptions)

        if len(insaneExceptions) != 0:
            raise insaneExceptions[0]

        if len(exceptions) != 0:
            raise TaskExecutionException(
                "Precompiler Errors (%s):" % type(self).__name__,
                "\n".join([
                    x.header + "\n    " +
                    x.message.replace("\n", "\n    ")
                    for x in exceptions]))

        return self.collect_output()
668369
def build_docs(directory):
    """"""
    os.chdir(directory)
    process = subprocess.Popen(["make", "html"], cwd=directory)
    process.communicate()
1274639
def _generate_output_dir(settings, path):
        

        relpath = os.path.relpath(settings.root,path)
        count = relpath.count(os.sep) + 1

        return relpath+os.path.sep, count
695088
def build(content_directory=None, out_directory=None):
    """"""
    content_directory = content_directory or '.'
    out_directory = os.path.abspath(out_directory or default_out_directory)
    repo = require_repo(content_directory)

    # Prevent user mistakes
    if out_directory == '.':
        raise ValueError('Output directory must be different than the source directory: ' + repr(out_directory))
    if os.path.basename(os.path.relpath(out_directory, content_directory)) == '..':
        raise ValueError('Output directory must not contain the source directory: ' + repr(out_directory))

    # TODO: read config
    # TODO: use virtualenv
    # TODO: init and run plugins
    # TODO: process with active theme

    # Collect and copy static files
    files = presentation_files(repo)
    remove_directory(out_directory)
    copy_files(files, out_directory, repo)

    return out_directory
1096499
def complete_from_dir(directory):
    '''
    
    '''
    global currDirModule
    if currDirModule is not None:
        if len(sys.path) > 0 and sys.path[0] == currDirModule:
            del sys.path[0]

    currDirModule = directory
    sys.path.insert(0, directory)
1078563
def build(self):
        """"""
        for cmd in self.build_cmds:
            log.info('building command: {}'.format(cmd))
            full_cmd = 'cd {}; {}'.format(self.analyses_path, cmd)
            log.debug('full command: {}'.format(full_cmd))
            subprocess.call(full_cmd, shell=True)
            log.info('build done')
77766
def dump(self):
        """"""
        id = self.get("id")
        if not id:
            id = "(none)"
        else:
            id = id[0]

        parent = self.get("parent")
        if not parent:
            parent = "(none)"
        else:
            parent = parent[0]

        print "'%s'" % id
        print "Parent project:%s", parent
        print "Requirements:%s", self.get("requirements")
        print "Default build:%s", string.join(self.get("debuild-build"))
        print "Source location:%s", string.join(self.get("source-location"))
        print "Projects to build:%s", string.join(self.get("projects-to-build").sort());