def run(self, shell=None):
        if not self.args:
            self.out('Requires a config file argument')
            return 2
        print(self.args)

        if self.args.search_path:
            os.environ.setdefault('SSC_SEARCH_PATH',
                                  ':'.join(self.args.search_path))

        if self.args.yaml_search_path:
            os.environ.setdefault(
                'SSC_YAML_SEARCH_PATH',
                ':'.join(self.args.yaml_search_path))
        if self.args.yaml_search_recursive is not None:
            os.environ.setdefault(
                'SSC_YAML_SEARCH_RECURSIVE',
                '1' if self.args.yaml_search_recursive else '0')

        if self.args.xls_search_path:
            os.environ.setdefault(
                'SSC_XLS_SEARCH_PATH',
                ':'.join(self.args.xls_search_path))
        if self.args.xls_search_recursive is not None:
            os.environ.setdefault(
                'SSC_XLS_SEARCH_RECURSIVE',
                '1' if self.args.xls_search_recursive else '0')

        if self.args.json_base_path:
            os.environ.setdefault('SSC_JSON_BASE_PATH',
                                  self.args.json_base_path)

        if self.args.timezone:
            os.environ.setdefault('SSC_TIMEZONE',
                                  self.args.timezone)

        for config in self.args.config:
            converter = Converter(YamlConfig.get_config(config))
            converter.run()
Exemplo n.º 2
0
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import os
from spreadsheetconverter import Converter, YamlConfig


if __name__ == "__main__":
    os.environ.setdefault("SSC_SEARCH_PATH", os.path.join(os.getcwd()))

    os.environ.setdefault("SSC_YAML_SEARCH_PATH", os.path.join(os.getcwd(), "yaml"))
    os.environ.setdefault("SSC_YAML_SEARCH_RECURSIVE", "1")

    os.environ.setdefault("SSC_XLS_SEARCH_PATH", os.path.join(os.getcwd(), "xls"))
    os.environ.setdefault("SSC_XLS_SEARCH_RECURSIVE", "1")

    os.environ.setdefault("SSC_JSON_BASE_PATH", os.path.join(os.getcwd(), "json"))

    converter = Converter(YamlConfig.get_config("user/user.yaml"))
    converter.run()
Exemplo n.º 3
0
# -*- coding:utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import os
from spreadsheetconverter import Converter, YamlConfig

if __name__ == '__main__':
    os.environ.setdefault('SSC_SEARCH_PATH', os.path.join(os.getcwd()))

    os.environ.setdefault('SSC_YAML_SEARCH_PATH',
                          os.path.join(os.getcwd(), 'yaml'))
    os.environ.setdefault('SSC_YAML_SEARCH_RECURSIVE', '1')

    os.environ.setdefault('SSC_XLS_SEARCH_PATH',
                          os.path.join(os.getcwd(), 'xls'))
    os.environ.setdefault('SSC_XLS_SEARCH_RECURSIVE', '1')

    os.environ.setdefault('SSC_JSON_BASE_PATH',
                          os.path.join(os.getcwd(), 'json'))

    converter = Converter(YamlConfig.get_config('user/user.yaml'))
    converter.run()