コード例 #1
0
ファイル: launcher.py プロジェクト: barmi/ibmkr_badge2018
    def Status(self, data=None):
        self.destroy()
        self.create_window()
        w = self.window
        y = 10
        gap = 5
        height = 35
        ugfx.Label(10, y, w.width() - 20, height, 'Platform: {}'.format(util.get_version()), parent=w)
        y += gap + height
        ugfx.Label(10, y, w.width() - 20, height, 'Release: {}'.format(uos.uname()[2]), parent=w)
        y += gap + height
        ugfx.Label(10, y, w.width() - 20, height, 'firmware:', parent=w)
        ugfx.set_default_font('IBMPlexMono_Bold18')
        y += height
        ugfx.Label(10, y, w.width() - 20, height + 10, '{}'.format(uos.uname()[3]), parent=w)
        ugfx.set_default_font(self.default_font)
        ugfx.set_default_font('IBMPlexSans_Regular18')
        self.create_status_box()
        ugfx.set_default_font(self.default_font)

        try:
            ota_data = ota.check_version()
        except ota.OtaException as e:
            self.set_status('Error: {}'.format(e))
        else:
            if ota_data:
                self.status_box.destroy()
                ugfx.Label(10, 180, 200, 40, text='New: {}'.format(ota_data['version']),
                    parent=w)
                self.btngroup = ButtonGroup(self.window, 190, 180, 110, 40, 10)
                self.btngroup.add('Upgrade', self.install_ota, ota_data)
                self.btngroup.end()
            else:
                self.set_status('Up to date')
コード例 #2
0
ファイル: doconv.py プロジェクト: pombredanne/doconv
def main():
    # parse CLI arguments
    arguments = docopt(__doc__, version='doconv ' + get_version())
    input_format = arguments['<input_format>']
    output_format = arguments['<output_format>']
    input_file = arguments['<file>']
    output_file = arguments['--out-file']
    verbose = arguments['--verbose']

    if verbose:
        logger.setLevel(logging.DEBUG)

    try:
        input_file_path = path.abspath(input_file)

        if output_file:
            output_file_path = path.abspath(output_file)
            convert(input_file_path, input_format, output_format,
                    output_file_path)
        else:
            convert(input_file_path, input_format, output_format)
    except Exception as e:
        if not verbose:
            print(e)
        else:
            logger.exception(e)

        sys.exit(1)
コード例 #3
0
ファイル: patchbot.py プロジェクト: rwst/patchbot
 def __init__(self, sage_root, server, config_path, dry_run=False, plugin_only=False):
     self.sage_root = sage_root
     self.server = server
     self.base = get_version(sage_root)
     self.behind_base = {}
     self.dry_run = dry_run
     self.plugin_only = plugin_only
     self.config_path = config_path
     self.reload_config()
     self.last_pull = 0
コード例 #4
0
  def __init__( self, argv, i=1 ):
    argv = util.preprocess_argv(argv, i)
    version = util.get_version( argv[:-1], i )
    self._version = version
    self._dataset = argv[-1] #dataset
    self._version_root = util.make_path_in_workdir(self.version)
    self._dataset_root = os.path.join(self._version_root, self.dataset)

    # we need to create a Path like that
    # when extracting a thinned dataset
    util.mkdirp(self._dataset_root)
コード例 #5
0
ファイル: main.py プロジェクト: bdelbosc/pglog2sql
def main(argv=sys.argv):
    """Main test"""
    global USAGE
    parser = OptionParser(USAGE, formatter=TitledHelpFormatter(),
                          version="pglog2sql %s" % get_version())
    parser.add_option("-n", "--name", default="foo",
                      help="Prepared statement name")
    parser.add_option("-v", "--verbose", action="store_true",
                      help="Verbose output")
    options, args = parser.parse_args(argv)
    log = get_input(args[1:])
    ret = process(options.name, log, verbose=options.verbose)
    print ret
コード例 #6
0
    def finalize_options(self):
        self.set_undefined_options('build', ('build_base', 'build_base'),
                                   ('compress', 'compress'),
                                   ('force', 'force'))

        if self.build_dir is None:
            self.build_dir = os.path.join(self.build_base, 'web')

        self.web_files = self.distribution.web_files[1]
        (_, self.html_files, self.html_subst) = self.distribution.html_files

        self.version = util.get_version()

        if not self.compress:
            self.compress = False
コード例 #7
0
ファイル: main.py プロジェクト: aogonevskiy/benchbase
def main(argv=sys.argv):
    """Main test"""
    global USAGE
    parser = OptionParser(USAGE, formatter=TitledHelpFormatter(),
                          version="benchbase %s" % get_version())
    parser.add_option("-v", "--verbose", action="store_true",
                      help="Verbose output")
    parser.add_option("-l", "--logfile", type="string",
                      default=os.path.expanduser(DEFAULT_LOG),
                      help="Log file path")
    parser.add_option("-d", "--database", type="string",
                      default=os.path.expanduser(DEFAULT_DB),
                      help="SQLite db path")
    parser.add_option("-m", "--comment", type="string",
                      help="Add a comment")
    parser.add_option("-j", "--jmeter", action="store_true",
                      default=True,
                      help="JMeter input file")
    parser.add_option("-f", "--funkload", action="store_true",
                      default=False,
                      help="FunkLoad input file")
    parser.add_option("--rmdatabase", action="store_true",
                      default=False,
                      help="Remove existing database")
    parser.add_option("-o", "--output", type="string",
                      help="Report output directory")
    parser.add_option("-H", "--host", type="string",
                      help="Host name when adding sar report")
    parser.add_option("-r", "--runningavg", type="int",
                      default=5,
                      help="Number of second to compute the running average.")
    parser.add_option("--chart-width", type="int",
                      default=800,
                      help="Width of charts in report.")
    parser.add_option("--chart-height", type="int",
                      default=768,
                      help="Heigth of charts in report.")
    parser.add_option("--period", type="int",
                      help="Resolution in second")

    options, args = parser.parse_args(argv)
    init_logging(options)
    if len(args) == 1:
        parser.error("Missing command")
    cmd = args[1]
    fn = globals()['cmd_' + cmd]
    ret = fn(args[2:], options)
    return ret
コード例 #8
0
ファイル: main.py プロジェクト: bdelbosc/jenkviz
def main(argv=sys.argv):
    """Main test"""
    global USAGE
    parser = OptionParser(USAGE, formatter=TitledHelpFormatter(),
                          version="jenkviz %s" % get_version())
    parser.add_option("-v", "--verbose", action="store_true",
                      help="Verbose output")
    parser.add_option("-l", "--logfile", type="string",
                      default=os.path.expanduser(DEFAULT_LOG),
                      help="Log file path")
    parser.add_option("-d", "--database", type="string",
                      default=os.path.expanduser(DEFAULT_DB),
                      help="SQLite db path")
    parser.add_option("-o", "--output", type="string",
                      help="SVG output file")
    parser.add_option("--from-file", type="string",
                      help="Use html files in the the FROM_FILE directory instead of querying jenkins server.")
    parser.add_option("--to-file", type="string",
                      help="Save jenkins page into the TO_FILE directory.")
    parser.add_option("-r", "--reverse", action="store_true",
                      default=False,
                      help="Reverse crawl")
    parser.add_option("--direct", action="store_true",
                      default=False,
                      help="Display only direct upstream dependencies")
    parser.add_option("--explore", action="store_true",
                      default=False,
                      help="Display downstream build with external upstream")
    parser.add_option("-u", "--update", action="store_true",
                      default=False,
                      help="Always fetch build from server (update local database)")

    options, args = parser.parse_args(argv)
    if options.explore:
        options.direct = False
    init_logging(options)
    if len(args) == 1:
        parser.error("Missing command")
    cmd = args[1]
    fn = globals()['cmd_' + cmd]
    ret = fn(args[2:], options)
    return ret
コード例 #9
0
#
# (c) 2012 Commonwealth of Australia
#     Australian Bureau of Meteorology, COSPPac COMP
#     All Rights Reserved
#
# Authors: Danielle Madeley <*****@*****.**>

import os

from distutils.command.build_py import build_py as real_build_py
from distutils import log

import util

ver = util.get_version()

LOOK_BACK = 100  # chars


def try_and_seek(f, offset):
    try:
        f.seek(offset, os.SEEK_END)
    except IOError:
        # file too short
        pass


class build_py(real_build_py):
    def build_module(self, module, module_file, package):
        real_build_py.build_module(self, module, module_file, package)
コード例 #10
0
ファイル: patchbot.py プロジェクト: rwst/patchbot
 def human_readable_base(self):
     # TODO: Is this stable?
     version = get_version(self.sage_root)
     commit_count = subprocess.check_output(['git', 'rev-list', '--count', '%s..patchbot/base' % version])
     return "%s + %s commits" % (version, commit_count.strip())
コード例 #11
0
def info(p_json, p_home, p_repo, print_flag=True):
  import os

  p_user = util.get_user()
  p_is_admin = util.is_admin()
  pip_ver = get_pip_ver()

  this_os = ""
  this_uname = str(platform.system())
  host_ip = util.get_host_ip()
  wmic_path = os.getenv("SYSTEMROOT", "") + os.sep + "System32" + os.sep + "wbem" + os.sep + "wmic"
  if this_uname == "Windows":
    import psutil
    host_display = os.getenv('LOGONSERVER','') + '\\' + os.getenv('COMPUTERNAME')
    system_cpu_cores = os.getenv('NUMBER_OF_PROCESSORS','1')
    os_arch = os.getenv('PROCESSOR_ARCHITECTURE', '')
    cpu_model = check_output_wmic([wmic_path, "cpu", "get", "name"])
    ## system_memory_in_gb ######################################
    m = psutil.virtual_memory().total
    mem_bytes = int(m)
    system_memory_in_kbytes = mem_bytes / 1024.0
    system_memory_in_gb = str(mem_bytes / (1024.0**3))
  else:
    os_arch = util.getoutput("uname -m")
    host_display = util.get_host_short()

  ## Check the OS & Resources ########################################
  plat = util.get_os()
  os_major_ver = ""
  if this_uname == "Darwin":
    mem_mb = util.get_mem_mb()
    system_memory_in_kbytes = mem_mb * 1024
    system_memory_in_gb = mem_mb / 1024.0
    system_cpu_cores = util.get_cpu_cores()
    cpu_model=util.getoutput("/usr/sbin/sysctl -n machdep.cpu.brand_string")
    prod_name = util.getoutput("sw_vers -productName")
    prod_version = util.getoutput("sw_vers -productVersion")
    this_os = prod_name + " " + prod_version
  elif this_uname == "Linux":
    mem_mb = util.get_mem_mb()
    system_memory_in_kbytes = mem_mb * 1024
    system_memory_in_gb = mem_mb / 1024.0
    system_cpu_cores = util.get_cpu_cores()
    cpu_model=util.getoutput("grep 'model name' /proc/cpuinfo | head -1 | cut -d':' -f2")
    os_major_ver = util.getoutput("cat /etc/os-release | grep VERSION_ID | cut -d= -f2 | tr -d '\"'")
    if cpu_model == "":
      cpu_model="ARM"
    if os.path.exists("/etc/redhat-release"):
      this_os = util.getoutput("cat /etc/redhat-release")
    elif os.path.exists("/etc/system-release"):
      this_os = util.getoutput("cat /etc/system-release")
    elif os.path.exists("/etc/lsb-release"):
      this_os = util.getoutput("cat /etc/lsb-release | grep DISTRIB_DESCRIPTION | cut -d= -f2 | tr -d '\"'")
    elif os.path.exists("/etc/os-release"):
      this_os = util.getoutput("cat /etc/os-release | grep PRETTY_NAME | cut -d= -f2 | tr -d '\"'")
  elif this_uname == "Windows":
    caption = check_output_wmic([wmic_path, "os", "get", "caption"])
    svcpack = check_output_wmic([wmic_path, "os", "get", "servicepackmajorversion"])
    if svcpack == "0":
      this_os = caption
    else:
      this_os = caption + ", SP " + svcpack

  round_mem = util.pretty_rounder(float(system_memory_in_gb), 1)
  mem = str(round_mem) + " GB"

  cores = str(system_cpu_cores)

  cpu = cpu_model.strip()
  cpu = cpu.replace("(R)", "")
  cpu = cpu.replace("(TM)", "")
  cpu = cpu.replace(" CPU ", " ")

  os = this_os.replace(" release ", " ")
  os = os.replace(" (Final)", "")

  arch = os_arch.replace("x86_64", "AMD")
  arch = arch.replace("AMD64", "AMD")

  ver = util.get_version()
  [last_update_utc, last_update_local, unique_id] = util.read_hosts('localhost')
  if last_update_local:
    last_upd_dt = datetime.strptime(last_update_local, "%Y-%m-%d %H:%M:%S")
    time_diff = int(util.timedelta_total_seconds(datetime.now() - last_upd_dt))
    last_update_readable = util.get_readable_time_diff(str(time_diff), precision=2)

  versions_sql = util.get_versions_sql()
  perl_ver = util.get_perl_ver()
  [java_major_ver, java_ver] = util.get_java_ver()

  os_pkg_mgr = util.get_pkg_mgr()
  jvm_location = util.get_jvm_location()

  if p_json:
    infoJsonArray = []
    infoJson = {}
    infoJson['version'] = ver
    infoJson['home'] = p_home
    infoJson['user'] = p_user
    infoJson['host'] = host_display
    infoJson['host_short'] = util.get_host_short()
    infoJson['host_long'] = util.get_host()
    infoJson['host_ip'] = util.get_host_ip()
    infoJson['os'] = unicode(str(os),sys.getdefaultencoding(),errors='ignore').strip()
    infoJson['os_pkg_mgr'] = os_pkg_mgr
    infoJson['os_major_ver'] = os_major_ver
    infoJson['platform'] = unicode(str(plat),sys.getdefaultencoding(),errors='ignore').strip()
    infoJson['arch'] = arch
    infoJson['mem'] = round_mem
    infoJson['cores'] = system_cpu_cores
    infoJson['cpu'] = cpu
    infoJson['last_update_utc'] = last_update_utc
    if last_update_local:
      infoJson['last_update_readable'] = last_update_readable
    infoJson['unique_id'] = unique_id
    infoJson['repo'] = p_repo
    infoJson['versions_sql'] = versions_sql
    infoJson['system_memory_in_kb'] = system_memory_in_kbytes
    infoJson['python_ver'] = python_ver
    infoJson['python_exe'] = python_exe
    if pip_ver != 'None':
      infoJson['pip_ver'] = pip_ver
    infoJson['perl_ver'] = perl_ver
    infoJson['java_ver'] = java_ver
    infoJson['java_major_ver'] = java_major_ver
    infoJson['jvm_location'] = jvm_location
    infoJsonArray.append(infoJson)
    if print_flag:
      print(json.dumps(infoJson))
      return
    else:
      return infoJson

  if p_is_admin:
    admin_display = " (Admin)"
  else:
    admin_display = ""

  langs = "Python v" + python_ver
  if perl_ver > "":
    langs = langs + " | Perl v" + perl_ver
  if java_ver > "":
    langs = langs + " | Java v" + java_ver

  util.validate_distutils_click(False)

  print(style_start + ("#" * 70) + style_end)
  print(style_start + "#                IO: " + style_end + "v" + ver + "  " + p_home)
  print(style_start + "#       User & Host: " + style_end + p_user + admin_display + "  " + host_display)
  print(style_start + "#  Operating System: " + style_end + os.rstrip() + " - " + str(plat))
  print(style_start + "#           Machine: " + style_end + mem + ", " + cores + " vCPU, " + cpu)
  print(style_start + "# Programming Langs: " + style_end + langs)

  default_repo = "https://openrds-download.s3.amazonaws.com/REPO"
  if p_repo != default_repo:
    print(style_start + "#          Repo URL: " + style_end + p_repo)

  if versions_sql == "versions.sql":
    pass
  else:
    print(style_start + "#      Versions SQL: " + style_end + versions_sql)

  if not last_update_local:
    last_update_local="None"

  print(style_start + "#       Last Update: " + style_end + str(last_update_local))
  print(style_start + ("#" * 70) + style_end)
コード例 #12
0
    '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s')
if 'LOG_PATH' in app.config:
    file_handler = logging.handlers.TimedRotatingFileHandler(
        app.config['LOG_PATH'], when='midnight')
    file_handler.setLevel(logging.INFO)
    file_handler.setFormatter(formatter)
    app.logger.addHandler(file_handler)

stream_handler = logging.StreamHandler(sys.stdout)
stream_handler.setLevel(logging.INFO)
stream_handler.setFormatter(formatter)
app.logger.addHandler(stream_handler)
app.logger.setLevel(logging.INFO)

# Find version info
app.jinja_env.globals.update(COMMIT_STRING=util.get_version())

# Setup any data structures needed
logos.initialize_logos()
_steam_id_re = re.compile('steamcommunity.com/openid/id/(.*?)$')


def register_blueprints():
    from api import api_blueprint
    app.register_blueprint(api_blueprint)

    from match import match_blueprint
    app.register_blueprint(match_blueprint)

    from team import team_blueprint
    app.register_blueprint(team_blueprint)
コード例 #13
0
ファイル: cli.py プロジェクト: dynapp/dynapp-updater
def publish():
    for module in get_modules():
        module.publish(get_version())
コード例 #14
0
ファイル: __init__.py プロジェクト: splewis/get5-web
    '[%(asctime)s] {%(pathname)s:%(lineno)d} %(levelname)s - %(message)s')
if 'LOG_PATH' in app.config:
    file_handler = logging.handlers.TimedRotatingFileHandler(
        app.config['LOG_PATH'], when='midnight')
    file_handler.setLevel(logging.INFO)
    file_handler.setFormatter(formatter)
    app.logger.addHandler(file_handler)

stream_handler = logging.StreamHandler(sys.stdout)
stream_handler.setLevel(logging.INFO)
stream_handler.setFormatter(formatter)
app.logger.addHandler(stream_handler)
app.logger.setLevel(logging.INFO)

# Find version info
app.jinja_env.globals.update(COMMIT_STRING=util.get_version())

# Setup any data structures needed
logos.initialize_logos()
_steam_id_re = re.compile('steamcommunity.com/openid/id/(.*?)$')


def register_blueprints():
    from api import api_blueprint
    app.register_blueprint(api_blueprint)

    from match import match_blueprint
    app.register_blueprint(match_blueprint)

    from team import team_blueprint
    app.register_blueprint(team_blueprint)
コード例 #15
0
ファイル: main.py プロジェクト: zerolugithub/benchbase
def main(argv=sys.argv):
    """Main test"""
    global USAGE
    parser = OptionParser(USAGE,
                          formatter=TitledHelpFormatter(),
                          version="benchbase %s" % get_version())
    parser.add_option("-v",
                      "--verbose",
                      action="store_true",
                      help="Verbose output")
    parser.add_option("-l",
                      "--logfile",
                      type="string",
                      default=os.path.expanduser(DEFAULT_LOG),
                      help="Log file path")
    parser.add_option("-d",
                      "--database",
                      type="string",
                      default=os.path.expanduser(DEFAULT_DB),
                      help="SQLite db path")
    parser.add_option("-m", "--comment", type="string", help="Add a comment")
    parser.add_option("-j",
                      "--jmeter",
                      action="store_true",
                      default=True,
                      help="JMeter input file")
    parser.add_option("-f",
                      "--funkload",
                      action="store_true",
                      default=False,
                      help="FunkLoad input file")
    parser.add_option("--rmdatabase",
                      action="store_true",
                      default=False,
                      help="Remove existing database")
    parser.add_option("-o",
                      "--output",
                      type="string",
                      help="Report output directory")
    parser.add_option("-H",
                      "--host",
                      type="string",
                      help="Host name when adding sar report")
    parser.add_option("-r",
                      "--runningavg",
                      type="int",
                      default=5,
                      help="Number of second to compute the running average.")
    parser.add_option("--chart-width",
                      type="int",
                      default=800,
                      help="Width of charts in report.")
    parser.add_option("--chart-height",
                      type="int",
                      default=768,
                      help="Heigth of charts in report.")
    parser.add_option("--period", type="int", help="Resolution in second")

    options, args = parser.parse_args(argv)
    init_logging(options)
    if len(args) == 1:
        parser.error("Missing command")
    cmd = args[1]
    fn = globals()['cmd_' + cmd]
    ret = fn(args[2:], options)
    return ret
コード例 #16
0
ファイル: ota.py プロジェクト: barmi/ibmkr_badge2018
def check_version():
    data = download_json(version_url)
    if data['version'] != get_version():
        return data
    else:
        return None
コード例 #17
0
ファイル: cli.py プロジェクト: dynapp/dynapp-updater
def update(username, password):
    info('Searching for version...')

    init_github(username, password)
    for module in get_modules():
        module.update(get_version())
コード例 #18
0
ファイル: setup.py プロジェクト: lowks/gevent_async
from setuptools import setup, find_packages

from util import get_version, read_requirements, read_file


NAME = 'gevent_async'
VERSION = get_version(NAME)
README = read_file("README.rst")
CHANGES = ''


setup(
    name=NAME,
    version=VERSION,
    classifiers=[
        "Programming Language :: Python",
        "Development Status :: 4 - Beta",
        "Programming Language :: Python :: 2 :: Only",
        "Programming Language :: Python :: Implementation :: CPython",
        "Topic :: Utilities"
    ],
    author='Olivier Carrere',
    description=('A small set of utilities to help with writing synchronous'
                 'code flows in a collaborative multitasking context.'),
    author_email='*****@*****.**',
    url='http://github.com/kapouille/gevent_async',
    keywords='gevent state asychronous synchronous',
    packages=find_packages(exclude=['tests']),
    include_package_data=True,
    zip_safe=False,
    install_requires=read_requirements('requirements.txt'),