Example #1
0
def mafft(platform):
    step = 6

    # Message
    sys.stdout.write(
        strftime("%Y-%m-%d %H:%M:%S") + ColorOutput(
            ' Multiple sequence alignemnt of core genes .....\n', 'IMP'))

    if platform.lower() == "darwin":
        mafft_path = os.path.abspath("binaries/mafft/darwin/")
    elif platform.lower() == "linux":
        mafft_path = os.path.abspath("binaries/mafft/linux/bin/")

    data_path = os.path.abspath("pan_genome/")
    out_path = os.path.abspath("phylogeny/")

    t0_time = time.time()
    for root, dirs, files in os.walk(data_path):
        for file in files:
            if file.endswith('.fna'):
                fl = os.path.join(root, file)
                fname = file.split('.')[0]
                cmd = '%s/mafft --thread 10 --auto --quiet %s > %s/%s.aln' % (
                    mafft_path, fl, out_path, fname)
                if os.system(cmd): exit()

    t1_time = time.time()
    print(t1_time - t0_time, "Mafft")

    return step
Example #2
0
        def sanitize_platform(platform):
            ''' Sanitizes platform '''
            std_platforms = {
                "ps4": "ps4",
                "orbis": "ps4",
                "xboxone": "xboxone",
                "dingo": "xboxone",
                "win32": "win32",
                "pcconsole": "win32",
                "win64": "win64",
                "pc": "win64",
                "windows": "win64",
                "xbox360": "xbox360",
                "x360": "xbox360",
                "ps3": "ps3",
                "linux": "linux",
                "android": "android",
                "mac": "mac",
                "macos": "mac",
                "ios": "ios"
            }

            if platform.lower() not in std_platforms:
                return platform
            return std_platforms[platform.lower()]
Example #3
0
def download_ffmpeg(out=os.getcwd()):
    platform, arch = detect_platform()
    if platform.lower() == "windows":
        if arch.lower() == '32bit':
            ffmpeg_url = "https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.zip"
        elif arch.lower() == '64bit':
            ffmpeg_url = "https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-latest-win64-static.zip"
        ffmpeg = download_file(url=ffmpeg_url, out=out)
        logger.info("%s downloaded" % ffmpeg)
        #unzip_without_overwrite(src_path=ffmpeg, dst_dir=out)
        with zipfile.ZipFile(ffmpeg, 'r') as zip_ref:
            # zip_ref.extractall(out)
            for file in zip_ref.filelist:
                if not os.path.exists(file.filename):
                    zip_ref.extract(file, out)
                if file.filename.endswith("ffmpeg.exe") and (not file.is_dir()) and int(file.file_size) > 0:
                    ffmpeg_binary = file.filename
                    break

    elif platform.lower() == "linux":
        if arch.lower() == '32bit':
            ffmpeg_url = "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz"
        elif arch.lower() == '64bit':
            ffmpeg_url = "https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz"
        ffmpeg = download_file(url=ffmpeg_url, out=out)
        logger.info("%s downloaded" % ffmpeg)
        with contextlib.closing(lzma.LZMAFile(ffmpeg)) as xz:
            with tarfile.open(fileobj=xz) as f:
                # f.extractall(out)
                for member in f.members:
                    if not os.path.exists(member.name):
                        f.extractfile(member)
                    if member.name.endswith('ffmpeg') and int(member.size) > 0 and int(member.mode) == 493:
                        ffmpeg_binary = member.name
                        break

    elif platform.lower() == "darwin":
        ffmpeg_url = "https://ffmpeg.zeranoe.com/builds/macos64/static/ffmpeg-latest-macos64-static.zip"
        ffmpeg = download_file(url=ffmpeg_url, out=out)
        logger.info("%s downloaded" % ffmpeg)
        #unzip_without_overwrite(src_path=ffmpeg, dst_dir=out)
        with zipfile.ZipFile(ffmpeg, 'r') as zip_ref:
            # zip_ref.extractall(out)
            for file in zip_ref.filelist:
                if not os.path.exists(file.filename):
                    zip_ref.extract(file, out)
                if file.filename.endswith("ffmpeg") and (not file.is_dir()) and int(file.file_size) > 0:
                    ffmpeg_binary = file.filename
                    break

    else:
        ffmpeg_url = False
        logger.error("Unsupported system")
        return False

    filesize = os.path.getsize(ffmpeg_binary)
    logger.info("ffmpeg location on [{path}], size = [{size}]".format(
        path=ffmpeg_binary, size=filesize))

    return ffmpeg_binary
Example #4
0
def RaXML(platform):
    step = 8

    # Message
    sys.stdout.write(
        strftime("%Y-%m-%d %H:%M:%S") + ColorOutput(
            ' Phylogenetic analysis of core genome using RaXML .....\n', 'IMP')
    )

    if platform.lower() == "darwin":
        RaXML_path = os.path.abspath("binaries/standard-RAxML-master/darwin/")
    elif platform.lower() == "linux":
        RaXML_path = os.path.abspath("binaries/standard-RAxML-master/linux/")

    data_path = os.path.abspath("phylogeny/")
    out_path = os.path.abspath("phylogeny/")

    os.chdir(out_path)
    t0_time = time.time()
    cmd = "%s/raxmlHPC -m PROTGAMMABLOSUM62 -p 12345 -x 12345 -s %s/concatenated.out -n CORE -f a -N 50" % (
        RaXML_path, data_path)
    if os.system(cmd): exit()
    t1_time = time.time()
    print(t1_time - t0_time, "RaXML")
    os.chdir("../")

    return step
Example #5
0
def nwTree(platform):
    step = 9

    # Message
    sys.stdout.write(
        strftime("%Y-%m-%d %H:%M:%S") + ColorOutput(
            ' Building phylogenetic tree using Newick tools .....\n', 'IMP'))

    if platform.lower() == "darwin":
        nwTree_path = os.path.abspath("binaries/nwTree/darwin/")
    elif platform.lower() == "linux":
        neTree_path = os.path.abspath("binaries/nwTree/linux/bin/")

    data_path = os.path.abspath("phylogeny/")
    out_path = os.path.abspath("phylogeny/")

    CORE_file = "RAxML_bestTree.CORE"
    t0_time = time.time()
    for root, dirs, files in os.walk(data_path):
        if CORE_file in files:
            fl = os.path.join(root, CORE_file)
            fname = CORE_file.split('.')[0]
            cmd = '%s/nw_display -s -S -b opacity:0 %s > %s/%s.svg' % (
                nwTree_path, fl, out_path, fname)
            #pdf= 'inkscape -f %s/%s.svg -A %s.pdf'% (fname,out_path,fname)
            if os.system(cmd): exit()
            #if os.system(pdf):exit()

    t1_time = time.time()
    print(t1_time - t0_time, "nwTree")

    return step
Example #6
0
 def ChoseDriver(self, platform):
     '''
         Start the browser
         platform:the type of browser
     '''
     if platform.lower() == "chrome":
         #operation= webdriver.ChromeOptions()
         #operation.add_argument('--user-data-dir=C:\\Users\FF\AppData\Local\Google\Chrome\\User Data') #设置成用户自己的数据目录
         #driver = webdriver.Chrome(chrome_options=operation)
         #driver = webdriver.Chrome()
         option = webdriver.ChromeOptions()
         option.add_argument('--disable-popup-blocking')
         option.add_argument('disable-infobars')
         driver = webdriver.Chrome(chrome_options=option)
     elif platform.lower() == "ie":
         iedriver = "C:\Program Files (x86)\Internet Explorer\IEDriverServer.exe"
         os.environ["webdriver.ie.driver"] = iedriver
         driver = webdriver.Ie(iedriver)
         #driver = webdriver.Ie()
     else:
         profile = webdriver.FirefoxProfile()
         profile.set_preference("browser.startup.homepage", "about:blank")
         profile.set_preference("startup.homepage_welcome_url",
                                "about:blank")
         profile.set_preference("startup.homepage_welcome_url.additional",
                                "about:blank")
         driver = webdriver.Firefox(profile)
     driver.maximize_window()
     #driver.set_window_size(400,900)
     driver.implicitly_wait(5)
     return driver
Example #7
0
def check_package(name, compVersion=None, platform="all"):

        if platform.lower() == LINUX.lower() and _PLATFORM != LINUX:
                return True

        if MACOS.lower() in platform.lower() and _PLATFORM != MACOS:
                return True

        check = sh("which %s" % name, header=None, output=False)
        check = check.strip()

        if not check:
            if _PLATFORM == MACOS:
                    check = sh("brew info %s | grep -i -E \"(not installed|error)\"" % name, header=None, output=False)
                    check = check.lower().strip()

                    if "not installed" in check or 'error' in check:
                            console.error('%s is M.I.A' % name)
                            console.log(' => "brew install %s"' % name)
                            console.error('')
                            console.fail('%s not installed' % name)
            else:
                        check = sh("aptitude show %s | grep -i -E \"(unable to locate|not installed)\"" % name, header=None, output=False)
                        check = check.lower().strip()

                        if "unable to locate" in check or 'not installed' in check:
                                console.error('%s is M.I.A' % name)
                                console.log(' => "aptitude install %s"' % name)
                                console.error('')
                                console.fail('%s not installed' % name)

        pVersion = get_package_version(name)

        goodVersion = True

        if compVersion:
                (op, wishVersion) = re_c.match(compVersion).groups()

                if op == "==":
                        goodVersion = (version.StrictVersion(pVersion) == version.StrictVersion(wishVersion))
                elif op == "<=":
                        goodVersion = (version.StrictVersion(pVersion) <= version.StrictVersion(wishVersion))
                elif op == ">=":
                        goodVersion = (version.StrictVersion(pVersion) >= version.StrictVersion(wishVersion))
                elif op == "<":
                        goodVersion = (version.StrictVersion(pVersion) < version.StrictVersion(wishVersion))
                elif op == ">":
                        goodVersion = (version.StrictVersion(pVersion) > version.StrictVersion(wishVersion))
                else:
                        console.fail('bad comp %s' % op)

        if goodVersion is True:
                console.confirm('%s : OK (%s)' % (name, pVersion))
        else:
                console.error('%s : OK (%s not %s)' % (name, pVersion,
                                                       compVersion))

                console.fail('Failed on version comp %s ' % name)

        return True
def _get_standardized_platform_name(platform):
    """Return the native project standards platform name for the target platform string"""
    if platform.lower() == 'darwin' or platform.lower() == 'macosx':
        return 'macos'

    if platform.lower()[:3] == 'win':
        return 'win32'  # true even for 64-bit builds

    if platform.lower()[:3] == 'lin':
        return 'linux'
Example #9
0
    def __init__(self, interpreter, abi, platform):
        """Initialize the instance attributes.

        All values are lowercased.

        """
        self._tags = interpreter.lower(), abi.lower(), platform.lower()
Example #10
0
    def tag_score(self):
        # type: () -> Tuple[int, int, int, int]
        py_version_score = (self.py_version.tag_score
                            if self.py_version is not None else 0)
        try:
            abi_score = ABI_TAGS.index(self.abi) if self.abi is not None else 0
        except ValueError:
            abi_score = 0

        try:
            plat_score = len(self.platforms) - min(
                PLATFORM_TAGS.index(platform.lower())
                for platform in self.platforms)
        except ValueError:
            plat_score = 0
            for plat in self.platforms:
                plat = LEGACY_ALIASES.get(plat, plat)
                manylinux_match = re.match(MANYLINUX_REGEX, plat)
                if manylinux_match is not None:
                    plat_score = max(
                        plat_score,
                        int(manylinux_match.groups()[0]) * 10 +
                        int(manylinux_match.groups()[1]),
                    )

        # Spaces in source dist filenames penalize them in the search order
        extra_score = (0 if isinstance(self.filename, six.string_types)
                       and " " in self.filename else 1)
        return py_version_score, plat_score, abi_score, extra_score
Example #11
0
 def shutdown_pc(self):
     """Shutting down the pc via command shutdown"""
     if platform.lower() == 'windows':
         os.system('shutdown -s')
     else:
         os.system('shutdown -h +1 "Shutting down via Email command"')
     exit()
Example #12
0
def loadBlacklist(apiname, platform):
	blacklistPath = os.path.join(coverageDir, "blacklist", platform.lower(), "%s.json" % apiname)
	if not os.path.isfile(blacklistPath):
		return { "functions": [], "properties": [] }

	print blacklistPath
	return json.load(open(blacklistPath))
Example #13
0
def is_unix_like(platform=None):
    """Returns whether the given platform is a Unix-like platform with the usual
    Unix filesystem. When the parameter is omitted, it defaults to ``sys.platform``
    """
    platform = platform or sys.platform
    platform = platform.lower()
    return platform.startswith("linux") or platform.startswith("darwin") or \
            platform.startswith("cygwin")
Example #14
0
def is_unix_like(platform=None):
    """Returns whether the given platform is a Unix-like platform with the usual
    Unix filesystem. When the parameter is omitted, it defaults to ``sys.platform``
    """
    platform = platform or sys.platform
    platform = platform.lower()
    return platform.startswith("linux") or platform.startswith("darwin") or \
            platform.startswith("cygwin")
def console_dispath(platform: str, **kwargs) -> None:
    """Select console method based on host OS"""
    console_functions = {
        "windows": start_putty_session,
        "linux": start_shell_session,
    }
    func = console_functions.get(platform.lower(), start_shell_session)
    return func(**kwargs)
Example #16
0
        def air_install(ctx, platform, package):
            ctx.to_log("Installing %s to %s device...\n" % (app_id, platform))

            from subprocess import PIPE  # Squelch some noisy errors

            platform = platform.lower()
            ctx.exec_command([adt, "-uninstallApp", "-platform", platform, "-appid", app_id], stderr=PIPE)
            ctx.exec_command([adt, "-installApp", "-platform", platform, "-package", package])
            ctx.exec_command([adt, "-launchApp", "-platform", platform, "-appid", app_id], stderr=PIPE)
Example #17
0
def find_target_platform(tail_args):
    try:
        target_platform_index = tail_args.index('--target-platform')
        return tail_args[target_platform_index + 1].lower()
    except ValueError:
        target_platform = [arg for arg in tail_args if '--target-platform' in arg]
        if target_platform:
            _, platform = target_platform[0].split('=')
            return platform.lower()
    return None
Example #18
0
def find_target_platform(tail_args):
    try:
        target_platform_index = tail_args.index('--target-platform')
        return tail_args[target_platform_index + 1].lower()
    except ValueError:
        target_platform = [arg for arg in tail_args if '--target-platform' in arg]
        if target_platform:
            _, platform = target_platform[0].split('=')
            return platform.lower()
    return None
Example #19
0
 def __init__(self, name=None, file=None, platform='linux'):
     self.trade_period = 'day'
     self.log_logger = get_import_log_handler()
     self.datadict = OrderedDict()
     self.static_first_record_timestamp = 0
     self.first_record_timestamp = 0
     self.last_record_timestamp = 0
     self.db_port = '8086' if platform.lower() == 'linux' else '4086'
     self.endpoint_url = 'http://localhost:8086/query' if platform.lower() == 'linux' else 'http://localhost:4086/query'
     self.folder_path = os.path.abspath(os.path.dirname(__file__)) + '/'
     self.config_name = name
     self.cfg_file = self.read_config_file()
     self.config_data = self.cfg_file[name]
     self.file_name = file if file else self.cfg_file[self.config_name]['filename']
     self.date_list = list()
     self.time_list = list()
     self.each_interval_data = deepcopy(fill_order_org_empty_dict(OrderedDict()))
     self.interval_sum_data_dict = deepcopy(fill_order_org_list_dict(OrderedDict()))
     self.interval_datadict = OrderedDict()
Example #20
0
def get_ati_ka(platform):
    ef_ip_list = []
    for key, info in psutil.net_if_addrs().items():
        if 'window' in platform.lower():
            ip_addr, net_mask = info[1][1:3]
        elif 'linux' in platform.lower():
            ip_addr, net_mask = info[0][1:3]
        if ip_addr in ['127.0.0.1', '169.254.76.15']:
            continue
        if is_valid_ip(ip_addr):
            if 'window' in platform.lower():
                ret = subprocess.getoutput('ping -n 1 {0}'.format(ip_addr))
                if u"已发送 = 1,已接收 = 1" in ret:
                    ef_ip_list.append((ip_addr, net_mask))
            elif 'linux' in platform.lower():
                ret = subprocess.getoutput('ping -c 1 {0}'.format(ip_addr))
                if "1 packets transmitted, 1 received" in ret:
                    ef_ip_list.append((ip_addr, net_mask))
    return ef_ip_list
 def __init__(self, interpreter: str, abi: str, platform: str) -> None:
     self._interpreter = interpreter.lower()
     self._abi = abi.lower()
     self._platform = platform.lower()
     # The __hash__ of every single element in a Set[Tag] will be evaluated each time
     # that a set calls its `.disjoint()` method, which may be called hundreds of
     # times when scanning a page of links for packages with tags matching that
     # Set[Tag]. Pre-computing the value here produces significant speedups for
     # downstream consumers.
     self._hash = hash((self._interpreter, self._abi, self._platform))
Example #22
0
def CleanFiles(currentPath, platform):
    import os, glob

    if platform.lower() == "windows":
        if len(filter(os.path.isfile, glob.glob('./*.pyc'))) > 0:
            os.system('del /q "' + currentPath + '*.pyc"')
        if len(filter(os.path.isfile, glob.glob('./*.pyo'))) > 0:
            os.system('del /q "' + currentPath + '*.pyo"')
    else:
        os.system("rm -rf " + currentPath + "*.pyc")
        os.system("rm -rf " + currentPath + "*.pyo")
Example #23
0
 def checkIfPlatformIsSupportedForHostCPU(cls, platform):
     """
   Checks if host Os supports specific platform.
   :param platform: platform to check for
   :return: True if platform is supported
 """
     if platform.lower() not in Settings.supportedPlatformsForHostOs[
             cls.hostOs]:
         cls.logger.warning(platform + ' is not supported.')
         return False
     return True
Example #24
0
def CleanFiles(currentPath, platform):
    import os, glob
    
    if  platform.lower() == "windows":
        if len(filter(os.path.isfile, glob.glob('./*.pyc'))) > 0:
            os.system('del /q "' + currentPath + '*.pyc"')
        if len(filter(os.path.isfile, glob.glob('./*.pyo'))) > 0:            
            os.system('del /q "' + currentPath + '*.pyo"')
    else:
        os.system("rm -rf " + currentPath + "*.pyc")
        os.system("rm -rf " + currentPath + "*.pyo")
Example #25
0
    def parse(cls, platform):
        platform = platform.strip().lower()

        if platform == 'any':
            return cls('any', 'any', 'any')

        try:
            os_name, os_release, architecture = platform.lower().split('-')
        except ValueError:
            raise InvalidPlatform(platform)
        else:
            return cls(os_name, os_release, architecture)
Example #26
0
def _make_platform():
    # runtime identifier: platform, os, architecture, data-width, endianness
    # e.g. darwin-posix-i386-32bit-le
    import os, sys, platform, re
    machine = platform.machine()
    width = platform.architecture()[0]
    platform = "%s-%s-%s-%s-%s" % (
        sys.platform,
        os.name,
        re.compile(r'^i[3456]86$').sub('i386', machine),
        width,
        'le' if sys.byteorder == 'little' else 'be',
    )
    platform = platform.lower()
    return platform
Example #27
0
        def air_install(ctx, platform, package):
            ctx.to_log("Installing %s to %s device...\n" % (app_id, platform))

            from subprocess import PIPE  # Squelch some noisy errors
            platform = platform.lower()
            ctx.exec_command([
                adt, "-uninstallApp", "-platform", platform, "-appid", app_id
            ],
                             stderr=PIPE)
            ctx.exec_command([
                adt, "-installApp", "-platform", platform, "-package", package
            ])
            ctx.exec_command(
                [adt, "-launchApp", "-platform", platform, "-appid", app_id],
                stderr=PIPE)
Example #28
0
def get_commands(platform=platform.system()):
    args = {}
    if platform.lower() == 'windows':
      args['automount'] = '${app} /q /v \"${volume}\"'
      args['mount'] = '${app} /q /v \"${volume}\" /l${where}'
      args['mountpw'] = '${app} /q /v \"${volume}\" /l${where} /p${pw}'
      args['dismount'] = '${app} /q /d${where}'
      args['dismountall'] = '${app} /q'
    else:
      args['automount'] = 'sudo ${app} -t -k "" --protect-hidden=no \"${volume}\"'
      args['mount'] = 'sudo ${app} -t -k "" --protect-hidden=no \"${volume}\" \"${where}\"'
      args['mountpw'] = 'sudo ${app} -t -k "" --protect-hidden=no -p \'${pw}\' \"${volume}\" \"${where}\"'
      args['dismount'] = 'sudo ${app} -t -d \"${where}\"'
      args['dismountall'] = 'sudo ${app} -t -d'
    return args
Example #29
0
def prokka(platform):
    step = 3

    # Message
    sys.stdout.write(
        strftime("%Y-%m-%d %H:%M:%S") +
        ColorOutput(' Annotating genome with Prokka .....\n', 'IMP'))

    if platform.lower() == "darwin":
        prokka_path = os.path.abspath("binaries/prokka/darwin/bin/")
    elif platform.lower() == "linux":
        prokka_path = os.path.abspath("binaries/prokka/linux/bin/")

    data_path = os.path.abspath("data/data-master/")
    out_path = os.path.abspath("prokka_out/")
    files = os.listdir(data_path)

    params = ["--kingdom", "--outdir", "--prefix", "--locustag", ""]
    args = ["--kingdom Bacteria"]
    #passed_params = createPara(params, parameters)

    t0_time = time.time()

    if len(os.listdir(out_path)) == len(files):
        pass
    else:
        for i in files:
            sample = i.split('-')[0]
            cmd = '%s/prokka --kingdom Bacteria --outdir %s/prokka_%s --prefix %s --locustag %s %s/%s' % (
                prokka_path, out_path, sample, sample, sample, data_path, i)
            if os.system(cmd): exit()

    t1_time = time.time()
    print(t1_time - t0_time, "Prokka")

    return step
Example #30
0
    def _chromedriver_platform_string(self):
        platform = self.platforms.get(uname[0])

        if platform is None:
            raise ValueError("Unable to construct a valid Chrome package name for current platform")
        platform = platform.lower()

        if platform == "linux":
            bits = "64" if uname[4] == "x86_64" else "32"
        elif platform == "mac":
            bits = "64"
        elif platform == "win":
            bits = "32"

        return "%s%s" % (platform, bits)
Example #31
0
def _make_platform():
    # runtime identifier: platform, os, architecture, data-width, endianness
    # e.g. darwin-posix-i386-32bit-le
    import os, sys, platform, re

    machine = platform.machine()
    width = platform.architecture()[0]
    platform = "%s-%s-%s-%s-%s" % (
        sys.platform,
        os.name,
        re.compile(r"^i[3456]86$").sub("i386", machine),
        width,
        "le" if sys.byteorder == "little" else "be",
    )
    platform = platform.lower()
    return platform
Example #32
0
def find_target_platforms(tail_args):
    target_platforms = []

    arg_idx = 0
    while arg_idx < len(tail_args):
        arg = tail_args[arg_idx]
        if arg.startswith('--target-platform'):
            if len(arg) == len('--target-platform'):
                target_platforms.append(tail_args[arg_idx + 1])
                arg_idx += 2
            elif arg[len('--target-platform')] == '=':
                target_platforms.append(arg[(len('--target-platform') + 1):])
                arg_idx += 1
        else:
            arg_idx += 1

    return [platform.lower() for platform in target_platforms]
Example #33
0
def get_local_inbox_path(platform: Text) -> Text:
    """
    Return base path to local email inbox given a platform.

    Arguments:
    platform -- platform as lowercase string

    Returns:
    Path to inbox as string

    """
    platform = platform.lower()

    if platform in ['osx', 'mac', 'darwin']:
        return LOCAL_INBOX_PATH_OSX
    if platform.startswith('linux'):
        return LOCAL_INBOX_PATH_LINUX

    raise Exception('Unknown platform')
Example #34
0
    def __init__(self):
        level = logger.DEBUG
        # first try to find config file in user home (ubuntu)
        self.log = logger("voltrad1", level)
        path1=os.path.expanduser("~")
        self.linux_user1=""
        if "linux" in platform.lower():
            #self.linux_user1=os.getenv("USER")
            self.linux_user1=os.popen('whoami').read().rstrip()

        if self.linux_user1.lower() == "root":
            path1="/var/www"
        config_file = os.path.join(path1, '.voltrad1')
        if not os.path.exists(config_file):
            # use the config file in the user folder (windows)
            config_file = os.path.join(os.path.expanduser("~"), 'voltrad1.ini')
        self.log.info("Read config file [%s]" % (str(config_file) ))
        config = configparser.ConfigParser()
        config.read(config_file)
        self.config=config._sections
        #self.log.info("Read config sections [%s]" % (str(self.config) ))
        self.months = {1: 'Jan', 2: 'Feb', 3: 'Mar', 4: 'Apr', 5: 'May', 6: 'Jun',
          7: 'Jul', 8: 'Aug', 9: 'Sep', 10: 'Oct', 11: 'Nov', 12: 'Dec'}
Example #35
0
 def __init__(self, platform=platform.system(), variant='release',
               link=False, static=False, use_musl=False, musl_path=None,
               verbose=False, verbose_backend=False,
               include_dirs=(), library_dirs=(), libraries=(), objects=(),
               defines=()):
     self.platform = platform.lower()
     self.variant = variant
     self.link = link
     self.static = static
     self.use_musl = use_musl
     self.musl_path = musl_path
     self.verbose = verbose
     self.verbose_backend = verbose_backend
     self.include_dirs = list(include_dirs)
     self.library_dirs = list(library_dirs)
     self.libraries = list(libraries)
     self.objects = list(objects)
     self.defines = list(defines)
     if self.debug:
         self.defines.append(('DEBUG', ''))
         self.defines.append(('_DEBUG', ''))
     else:
         self.defines.append(('NDEBUG', ''))
Example #36
0
 def __init__(self, interpreter, abi, platform):
     self._interpreter = interpreter.lower()
     self._abi = abi.lower()
     self._platform = platform.lower()
Example #37
0
from os.path import dirname, abspath
from zipfile import ZipFile
import platform
import json

platform = platform.system()
mod_path = dirname(abspath(__file__))
mod_name = ""
utility = False

if platform.lower() == "windows":
    stripped_path = mod_path.split("\\")
    mod_name = stripped_path[-1]

if platform.lower() == "linux":
    stripped_path = mod_path.split("/")
    mod_name = stripped_path[-1]

mod_info = open("mod_info.json", "r")
json_object = json.load(mod_info)
mod_info.close()

version = input("Enter new version number: ")
json_object["version"] = version

mod_info = open("mod_info.json", "w")
json.dump(json_object, mod_info, indent=4)
mod_info.close()

file_name = mod_name + ".zip"
with ZipFile(file_name, "w") as myzip:
Example #38
0
from lib.reversetcp import generate_payload
from lib.screenshoter import generate_screenshoter
import random
import os
import platform
import time
import sys

banner = "banners/banner" + str(random.randint(1, 3)) + ".txt"
colors = ["red", "green", "yellow", "cyan"]
color = random.choice(colors)
answers = ["y", "yes", "n", "no"]
platform = platform.system()
__version__ = "BETA"

if platform.lower() == 'windows':
    clear = "cls"
else:
    clear = "clear"


def print_banner():
    with open("./lib/" + banner, "r") as b:
        print(colored(b.read(), color))


def clear_screen():
    os.system(clear)
    print_banner()

Example #39
0
mode = sys.argv[1]

print "Running mode = ",mode


basedir = "/var/www/html/topcons2/proj/pred/"
basedir = os.path.realpath(basedir)
path_md5   = "%s/static/md5"%(basedir)
path_result      = "%s/static/result"%(basedir)
path_cache = "%s/static/result/cache"%(basedir)

platform = platform.platform()

apacheusername = ""
if platform.lower().find("ubuntu") != -1:
    apacheusername = "******"
elif platform.lower().find("centos") != -1:
    apacheusername = "******"

isChangeOwner = False
if apacheusername != "":
    try:
        apacheusername_uid = pwd.getpwnam(apacheusername).pw_uid
        apacheusername_gid = grp.getgrnam(apacheusername).gr_gid
        isChangeOwner = True
    except:
        pass

VERBOSE=1
Example #40
0
 def __init__(self, interpreter, abi, platform):
     # type: (str, str, str) -> None
     self._interpreter = interpreter.lower()
     self._abi = abi.lower()
     self._platform = platform.lower()
Example #41
0
#!/usr/bin/env python
import re
import urllib
import platform

import requests
from bs4 import BeautifulSoup
from PIL import Image
import imgur_album as album
platform = platform.system()
print platform
try:
	if platform.lower() == 'windows':
		from change_background import apply_background as background
	if platform.lower() == 'linux':
		from change_background import apply_background_linux as background
except:
	print "Import Error. Unsupported OS"
	exit()

head = {'User-Agent': 'Mozilla/5.0'}

album_argument = open('random_wallpaper.txt', 'r'); RANDOM_ALBUM = int(album_argument.readline()); album_argument.close()
print RANDOM_ALBUM

def image_check(image):
	im=Image.open(image)
	is_image = im.size
	print "Resolution: {}".format(is_image)
	if is_image:
		return True