def handle(self, *args, **options): """Check the source code using PyLint.""" # Note that get_build_dir() is suitable for testing use only. pylint_prog = paths.get_build_dir('env', 'bin', 'pylint') pylint_args = [pylint_prog, "--rcfile=" + settings.PYLINTRC] if options['app'] == 'all': pylint_args.extend(self.valid_app()) else: pylint_args.append(options['app']) if options['force']: pylint_args.append('-f') if options['outputformat']: pylint_args.append(options['outputformat']) if not os.path.exists(pylint_prog): msg = _( "Cannot find pylint at '%(path)s'. Please install pylint first." ) % { 'path': pylint_prog } logging.error(msg) raise CommandError(msg) logging.info("Running pylint with args: %s" % (" ".join(pylint_args), )) # We exec pylint directly due to a "maximum recursion depth" bug when doing # pylint.lint(...) programmatically. subprocess.call(pylint_args)
def handle(self, *args, **options): """Check the source code using PyLint.""" pylint_args = list(args) if "all" in pylint_args or len(pylint_args) == 0: if "all" in pylint_args: pylint_args.remove("all") from desktop import appmanager apps = ["desktop"] for app in appmanager.DESKTOP_APPS: apps.append(app.name) pylint_args = apps + pylint_args # Note that get_build_dir() is suitable for testing use only. pylint_prog = paths.get_build_dir('env', 'bin', 'pylint') pylint_args = [pylint_prog, "--rcfile=" + settings.PYLINTRC ] + pylint_args if not os.path.exists(pylint_prog): msg = _( "Cannot find pylint at '%(path)s'. Please install pylint first." ) % { 'path': pylint_prog } logging.error(msg) raise CommandError(msg) logging.info("Running pylint with args: %s" % (" ".join(pylint_args), )) # We exec pylint directly due to a "maximum recursion depth" bug when doing # pylint.lint(...) programmatically. subprocess.call(pylint_args)
def handle(self, *args, **options): """Check the source code using PyLint.""" pylint_args = list(args) if "all" in pylint_args or len(pylint_args) == 0: if "all" in pylint_args: pylint_args.remove("all") from desktop import appmanager apps = ["desktop"] for app in appmanager.DESKTOP_APPS: apps.append(app.name) pylint_args = apps + pylint_args # Note that get_build_dir() is suitable for testing use only. pylint_prog = paths.get_build_dir('env', 'bin', 'pylint') pylint_args = [pylint_prog, "--rcfile=" + settings.PYLINTRC] + pylint_args if not os.path.exists(pylint_prog): msg = "Cannot find pylint at '%s'. Please install pylint first." % (pylint_prog,) logging.error(msg) raise CommandError(msg) logging.info("Running pylint with args: %s" % (" ".join(pylint_args),)) # We exec pylint directly due to a "maximum recursion depth" bug when doing # pylint.lint(...) programmatically. subprocess.call(pylint_args)
def handle(self, *args, **options): """Check the source code using PyLint.""" # Note that get_build_dir() is suitable for testing use only. pylint_prog = paths.get_build_dir('env', 'bin', 'pylint') pylint_args = [pylint_prog, "--rcfile=" + settings.PYLINTRC] if options['app']=='all': pylint_args.extend(self.valid_app()) else: pylint_args.append(options['app']) if options['force']: pylint_args.append('-f') if options['outputformat']: pylint_args.append(options['outputformat']) if not os.path.exists(pylint_prog): msg = _("Cannot find pylint at '%(path)s'. Please install pylint first.") % {'path': pylint_prog} logging.error(msg) raise CommandError(msg) logging.info("Running pylint with args: %s" % (" ".join(pylint_args),)) # We exec pylint directly due to a "maximum recursion depth" bug when doing # pylint.lint(...) programmatically. subprocess.call(pylint_args)
def _configs_from_dir(conf_dir): """ Generator to load configurations from a directory. This will only load files that end in .ini """ sorted_conf_file = [] for filename in sorted(os.listdir(conf_dir)): if filename.startswith(".") or not filename.endswith('.ini'): continue conf_name = filename.split('.') if len(conf_name) == 2: sorted_conf_file.append(filename) else: env = conf_name[-2] curr_env = os.environ.get('DJANGO_ENV', '').lower() if env == curr_env: sorted_conf_file.append(filename) for filename in sorted_conf_file: LOG.debug("Loading configuration from: %s" % filename) try: conf = ConfigObj(os.path.join(conf_dir, filename)) except ConfigObjError as ex: LOG.error("Error in configuration file '%s': %s" % (os.path.join(conf_dir, filename), ex)) raise conf['DEFAULT'] = dict(desktop_root=get_desktop_root(), build_dir=get_build_dir()) yield conf
def _make_filesystem(identifier): choice = os.getenv("FB_FS") if choice == "testing": path = os.path.join(get_build_dir(), "fs") if not os.path.isdir(path): LOG.warning(("Could not find fs directory: %s. Perhaps you need to run manage.py filebrowser_test_setup?") % path) return LocalSubFileSystem(path) else: cluster_conf = conf.HDFS_CLUSTERS[identifier] return webhdfs.WebHdfs.from_config(cluster_conf)
def _configs_from_dir(conf_dir): """ Generator to load configurations from a directory. This will only load files that end in .ini """ for filename in sorted(os.listdir(conf_dir)): if filename.startswith(".") or not filename.endswith('.ini'): continue logging.debug("Loading configuration from: %s" % filename) conf = configobj.ConfigObj(os.path.join(conf_dir, filename)) conf['DEFAULT'] = dict(desktop_root=get_desktop_root(), build_dir=get_build_dir()) yield conf
def _make_filesystem(identifier): choice = os.getenv("FB_FS") if choice == "testing": path = os.path.join(get_build_dir(), "fs") if not os.path.isdir(path): logging.warning( ("Could not find fs directory: %s. Perhaps you need to run " + "manage.py filebrowser_test_setup?") % path) return LocalSubFileSystem(path) else: cluster_conf = conf.HDFS_CLUSTERS[identifier] return hadoopfs.HadoopFileSystem.from_config( cluster_conf, hadoop_bin_path=conf.HADOOP_BIN.get())
def _configs_from_dir(conf_dir): """ Generator to load configurations from a directory. This will only load files that end in .ini """ for filename in sorted(os.listdir(conf_dir)): if filename.startswith(".") or not filename.endswith(".ini"): continue LOG.debug("Loading configuration from: %s" % filename) try: conf = configobj.ConfigObj(os.path.join(conf_dir, filename)) except configobj.ConfigObjError, ex: LOG.error("Error in configuration file '%s': %s" % (os.path.join(conf_dir, filename), ex)) raise conf["DEFAULT"] = dict(desktop_root=get_desktop_root(), build_dir=get_build_dir()) yield conf
def _configs_from_dir(conf_dir): """ Generator to load configurations from a directory. This will only load files that end in .ini """ for filename in sorted(os.listdir(conf_dir)): if filename.startswith(".") or not filename.endswith('.ini'): continue LOG.debug("Loading configuration from: %s" % filename) try: conf = ConfigObj(os.path.join(conf_dir, filename)) except ConfigObjError, ex: LOG.error("Error in configuration file '%s': %s" % (os.path.join(conf_dir, filename), ex)) raise conf['DEFAULT'] = dict(desktop_root=get_desktop_root(), build_dir=get_build_dir()) yield conf
def _make_filesystem(identifier): choice = os.getenv("FB_FS") if choice == "testing": path = os.path.join(get_build_dir(), "fs") if not os.path.isdir(path): LOG.warning( ("Could not find fs directory: %s. Perhaps you need to run " + "manage.py filebrowser_test_setup?") % path) return LocalSubFileSystem(path) else: cluster_conf = conf.HDFS_CLUSTERS[identifier] # The only way to disable webhdfs is to specify an empty value if cluster_conf.WEBHDFS_URL.get() != '': return webhdfs.WebHdfs.from_config(cluster_conf) else: return hadoopfs.HadoopFileSystem.from_config( cluster_conf, hadoop_bin_path=conf.HADOOP_BIN.get())
def handle_noargs(self, **options): fs_dir = os.path.join(get_build_dir(), "fs") if not os.path.isdir(fs_dir): os.makedirs(fs_dir) fs_for_testing.create(fs_dir) print _("Created fs in: %(dir)s") % {"dir": fs_dir}
def handle_noargs(self, **options): fs_dir = os.path.join(get_build_dir(), "fs") if not os.path.isdir(fs_dir): os.makedirs(fs_dir) fs_for_testing.create(fs_dir) print "Created fs in: %s" % fs_dir
def handle(self, *args, **options): fs_dir = os.path.join(get_build_dir(), "fs") if not os.path.isdir(fs_dir): os.makedirs(fs_dir) fs_for_testing.create(fs_dir) print _("Created fs in: %(dir)s") % {'dir': fs_dir}