Read files into setup
338175
def read_files(*files):
    """"""
    text = ""
    for single_file in files:
        content = read(single_file)
        text = text + content + "\n"
    return text
1049340
def setup_dir(f):
    ''' 
    '''
    setup_dir = os.path.dirname(os.path.abspath(__file__))

    def wrapped(*args, **kwargs):
        with chdir(setup_dir):
            return f(*args, **kwargs)

    return wrapped
387717
def setup_package():
    """"""
    import json
    from setuptools import setup, find_packages

    filename_setup_json = 'setup.json'
    filename_description = 'README.md'

    with open(filename_setup_json, 'r') as handle:
        setup_json = json.load(handle)

    with open(filename_description, 'r') as handle:
        description = handle.read()

    setup(
        include_package_data=True,
        packages=find_packages(),
        setup_requires=['reentry'],
        reentry_register=True,
        long_description=description,
        long_description_content_type='text/markdown',
        **setup_json)
1050599
def Setup():
    '''
    

    '''

    if not os.path.exists(os.path.join(EVEREST_DAT, 'k2', 'cbv')):
        os.makedirs(os.path.join(EVEREST_DAT, 'k2', 'cbv'))
    GetK2Stars(clobber=False)
357659
def setup_directories(base_dir, subdirs):
  """"""
  base_dir = os.path.expanduser(base_dir)
  tf.gfile.MakeDirs(base_dir)

  all_dirs = {}
  for subdir in subdirs:
    if isinstance(subdir, six.string_types):
      subdir_tuple = (subdir,)
    else:
      subdir_tuple = subdir
    dir_name = os.path.join(base_dir, *subdir_tuple)
    tf.gfile.MakeDirs(dir_name)
    all_dirs[subdir] = dir_name
  return all_dirs
478706
def read_config_files(files)
      configuration = clone

      begin
        files.each do |config_file|
          next if config_file.nil? || config_file.empty?
          new_config = read_config_file(config_file)
          configuration = Utils.deep_merge_hashes(configuration, new_config)
        end
      rescue ArgumentError => err
        Bunto.logger.warn "WARNING:", "Error reading configuration. " \
                     "Using defaults (and options)."
        $stderr.puts err
      end

      configuration.fix_common_issues.backwards_compatibilize.add_default_collections
    end
713832
def setup(self):
        """"""
        super(RequireJSFilter, self).setup()

        excluded_files = []
        for bundle in self.excluded_bundles:
            excluded_files.extend(
                map(lambda f: os.path.splitext(f)[0],
                    bundle.contents)
            )

        if excluded_files:
            self.argv.append(
                'exclude={0}'.format(','.join(excluded_files))
            )
251974
def read_file(paths):
    

    if isinstance(paths, str):
        paths = [paths]

    re = {}
    for path in paths:
        cfg = yaml.load(open(path))
        merge(re, cfg)

    return re
611724
def _setup(self, lines):
        '''
        '''
        bot.warning('SETUP is error prone, please check output.')

        for line in lines:

            # For all lines, replace rootfs with actual root /
            line = re.sub('[$]{?SINGULARITY_ROOTFS}?', 
                          '', '$SINGULARITY_ROOTFS')

            # If we have nothing left, don't continue
            if line in ['', None]:
                continue

            # If the line starts with copy or move, assume is file from host
            if re.search('(^cp|^mv)', line):
                line = re.sub('(^cp|^mv)', '', line)
                self.files.append(line)

            # If it's a general command, add to install routine
            else:
                self.install.append(line)
1052119
def read_setup_py(self):  # type: ()-> Dict[str,str]
        
        found = {}  # type: Dict[str,str]
        setup_py = os.path.join("setup.py")

        if not os.path.isfile(setup_py):
            if self.strict:
                logger.debug(unicode(os.getcwd()))
                logger.debug(unicode(os.listdir(os.getcwd())))
                # return ""
                # raise JiggleVersionException(
                #     "Can't find setup.py : {0}, path :{1}".format(setup_py, self.SRC)
                # )
                return found
            else:
                return found

        self.setup_py_source = self.file_opener.open_this(setup_py, "r").read()

        if "use_scm_version=True" in self.setup_py_source:
            die(
                -1,
                "setup.py has use_scm_version=True in it- this means we expect no file to have a version string. Nothing to change",
            )
            return {}

        with self.file_opener.open_this(setup_py, "r") as infile:
            for line in infile:
                version = kwarg_version.find_in_line(line)
                if version:
                    found[setup_py] = version
                    continue
                version, _ = dunder_version.find_in_line(line)
                if version:
                    found[setup_py] = version
                    continue

        # stress testing
        # if "version" in self.setup_py_source and not found:
        #     raise TypeError(self.setup_py_source)

        return found
1171552
function setup() {

    // check if config directory is given
    if( _config_path !== -1 ) {

      // get path
      var config_path = path.resolve( process.argv[ _config_path + 1 ] );

      // check if directory exists and is a valid directory
      fs.stat( config_path, function( err, stats ) {
        if( err && err.code === "ENOENT" ) {
          process.stdout.write( "The given directory doesn't exists.\n".red );
        } else if( err ) {

          // unknown error
          process.stdout.write( (err.message + "\n").red );
        } else if( !stats.isDirectory() ) {
          process.stdout.write( "The given config directory is not an actual directory.\n".red );
        } else {
          readConfigDir( config_path );
        }
      } );
      return;
    }

    // ask for config directory
    ask( "Where are your config files? ", function( c_path ) {
        readConfigDir( c_path );
    } );
}
1237153
function readFiles(files, config) {
  files.forEach((file) => {
    const text = readTemplate(file.source);
    file.text  = str_replace(
      [ '%proxy_host', '%proxy_port', '%username', '%password' ],
      [ config.host, config.port, config.username, config.password ],
      text
    );
  });
  return files;
}
1301601
function setup(done) {
    crontab.load(function(err, ct) {
      if (err) return done(err);
      clean(ct);
      load(ct);
      ct.save(done);
    });
  }
939426
def _parse_config_files(self, filenames=None):
        
        from setuptools.extern.six.moves.configparser import ConfigParser

        # Ignore install directory options if we have a venv
        if six.PY3 and sys.prefix != sys.base_prefix:
            ignore_options = [
                'install-base', 'install-platbase', 'install-lib',
                'install-platlib', 'install-purelib', 'install-headers',
                'install-scripts', 'install-data', 'prefix', 'exec-prefix',
                'home', 'user', 'root']
        else:
            ignore_options = []

        ignore_options = frozenset(ignore_options)

        if filenames is None:
            filenames = self.find_config_files()

        if DEBUG:
            self.announce("Distribution.parse_config_files():")

        parser = ConfigParser()
        for filename in filenames:
            with io.open(filename, encoding='utf-8') as reader:
                if DEBUG:
                    self.announce("  reading {filename}".format(**locals()))
                (parser.read_file if six.PY3 else parser.readfp)(reader)
            for section in parser.sections():
                options = parser.options(section)
                opt_dict = self.get_option_dict(section)

                for opt in options:
                    if opt != '__name__' and opt not in ignore_options:
                        val = self._try_str(parser.get(section, opt))
                        opt = opt.replace('-', '_')
                        opt_dict[opt] = (filename, val)

            # Make the ConfigParser forget everything (so we retain
            # the original filenames that options come from)
            parser.__init__()

        # If there was a "global" section in the config file, use it
        # to set Distribution options.

        if 'global' in self.command_options:
            for (opt, (src, val)) in self.command_options['global'].items():
                alias = self.negative_opt.get(opt)
                try:
                    if alias:
                        setattr(self, alias, not strtobool(val))
                    elif opt in ('verbose', 'dry_run'):  # ugh!
                        setattr(self, opt, strtobool(val))
                    else:
                        setattr(self, opt, val)
                except ValueError as msg:
                    raise DistutilsOptionError(msg)
727035
def setup(working_dir, interactive=False):
    
    # set up our implementation
    log.debug("Working dir: {}".format(working_dir))
    if not os.path.exists( working_dir ):
        os.makedirs( working_dir, 0700 )

    node_config = load_configuration(working_dir)
    if node_config is None:
        sys.exit(1)

    log.debug("config\n{}".format(json.dumps(node_config, indent=4, sort_keys=True)))
    return node_config
1354542
def setup_config(
        config_directories=None,
        config_file=None,
        default_filename="opentc.yml"
):
    
    config_found = False
    config_file_path = None
    if config_file:
        config_file_path = config_file
        if os.path.isfile(config_file_path) and os.access(config_file_path, os.R_OK):
            config_found = True
    else:
        for directory in config_directories:
            if directory is None:
                continue
            config_file_path = os.path.join(directory, default_filename)
            if os.path.isfile(config_file_path) and os.access(config_file_path, os.R_OK):
                config_found = True
                break
    if config_found:
        with open(config_file_path, 'rt') as ymlfile:
            config = yaml.safe_load(ymlfile.read())
        return config
    else:
        print("The configuration file is not found.")
        exit(1)
91949
def load(self, patterns, dirs, ignore=None):
        
        for dir_ in dirs:
            dir_root = dir_
            if os.path.exists(os.path.join(dir_, "__init__.py")):
                dir_root = os.path.abspath(os.path.join(dir_, os.pardir))

            for path in self.find_files(patterns=patterns, dirs=[dir_], ignore=ignore):
                data = self.read_file(path=path)
                if data:
                    data["relative_path"] = os.path.relpath(path, dir_root)
                    self.paths[path] = data