Exemple #1
0
def getOEUrl():
    oe = platform()
    
    if oe == 'oe-armv6-5':
        url = resource + 'openvpn-arm-5.zip'
        return url

    if oe == 'oe-armv6-6':
        url = resource + 'openvpn-arm-6.zip'
        return url

    if oe == 'oe-armv7-5':
        url = resource + 'openvpn-armv7-5.zip'
        return url

    if oe == 'oe-armv7-6':
        url = resource + 'openvpn-armv7-6.zip'
        return url

    if oe == 'oe-x86-5':
        url = resource + 'openvpn-x86-5.zip'
        return url

    if oe == 'oe-x86-6':
        url = resource + 'openvpn-x86-6.zip'
        return url

    return
Exemple #2
0
def main(
    argv=sys.argv,
    pkg_resources=pkg_resources,
    platform=platform.platform,
    out=out,
):
    # all args except argv are for unit testing purposes only
    parser = get_parser()
    parser.parse_args(argv[1:])
    packages = []
    for distribution in pkg_resources.working_set:
        name = distribution.project_name
        packages.append(
            {
                'version': distribution.version,
                'lowername': name.lower(),
                'name': name,
                'location': distribution.location,
            }
        )
    packages = sorted(packages, key=itemgetter('lowername'))
    pyramid_version = pkg_resources.get_distribution('pyramid').version
    plat = platform()
    out('Pyramid version:', pyramid_version)
    out('Platform:', plat)
    out('Packages:')
    for package in packages:
        out(' ', package['name'], package['version'])
        out('   ', package['location'])
Exemple #3
0
def checkOS():
    log('Checking OS setting')
    os = ADDON.getSetting('OS')

    if len(os) > 1:
        log('Operating system setting is %s' % os)
        return

    log('Operating system setting is currently not set')

    plat  = platform()
    error = 'Unable to determine correct OS setting'

    log('Platform detected is %s' % plat)

    if plat == 'android':
        os = 'Android'
    elif plat == 'linux':
        log(error)
    elif plat == 'windows':
        os = 'Windows'
    elif plat == 'osx':
        os = 'MacOS'
    elif plat == 'atv2':
        log(error)
    elif plat == 'ios':
        log(error)
    # elif 'oe' in plat:
    #     os = 'OpenELEC'

    if len(os) > 1:
        log('Setting system to %s' % os)
        ADDON.setSetting('OS', os)
Exemple #4
0
def main(argv=sys.argv, pkg_resources=pkg_resources, platform=platform.platform,
         out=out):
    # all args except argv are for unit testing purposes only
    description = "Show Python distribution versions and locations in use"
    usage = "usage: %prog"
    parser = optparse.OptionParser(usage, description=description)
    parser.parse_args(argv[1:])
    packages = []
    for distribution in pkg_resources.working_set:
        name = distribution.project_name
        packages.append(
            {'version': distribution.version,
             'lowername': name.lower(),
             'name': name,
             'location':distribution.location}
            )
    packages = sorted(packages, key=itemgetter('lowername'))
    pyramid_version = pkg_resources.get_distribution('pyramid').version
    plat = platform()
    out('Pyramid version:', pyramid_version)
    out('Platform:', plat)
    out('Packages:')
    for package in packages:
        out(' ', package['name'], package['version'])
        out('   ', package['location'])
	def BuildPage ( self ):
		l = Label(self,text='Demonstrate the PiCamera\'s abilities',
			anchor='center',font=('Helvetica',14),foreground='blue')
		l.grid(row=0,column=0,)
			
		l = Label(self,text='Copyright © 2015',
			anchor='center',font=('Helvetica',12))
		l.grid(row=1,column=0,)
		l = Label(self,text='Bill Williams',
			anchor='center',font=('Helvetica',12))
		l.grid(row=2,column=0,)	
			
		Separator(self,orient='horizontal').grid(row=3,column=0,
			columnspan=2,sticky='NSEW',pady=10)
					
		# See if Windows, Mac, or Linux. Why???? Only on PI for PiCamera!
		txt = win32_ver()[0]
		if txt:
			os = 'Windows OS: %s' % txt
		else:
			txt = mac_ver()[0]
			if txt:
				os = 'Mac OS: %s' % txt
			else:
				txt = linux_distribution()
				if txt[0]:
					os = 'Linux OS: %s %s' % ( txt[0].title(), txt[1] )
				else:
					os = 'Unknown OS'
		l = Label(self,text=os,font=('Helvetica',14))
		l.grid(row=4,column=0,sticky='NSEW')
		l = Label(self,text='Python Version: %s'%python_version())
		l.grid(row=5,column=0,sticky='NSEW')
	
		if NoRequire:
			PiVer = "Picamera ver ??"
		else:
			PiVer = "PiCamera ver %s" % require('picamera')[0].version
	
		l = Label(self,text=PiVer)
		l.grid(row=6,column=0,sticky='NSEW')
				
		s = processor()
		if s:
			txt = 'Processor: %s (%s)' % (processor(), machine())
		else:
			txt = 'Processor: %s' % machine()
		l = Label(self,text=txt)
		l.grid(row=7,column=0,sticky='NSEW')
		l = Label(self,text='Platform: %s'%platform())
		l.grid(row=8,column=0,sticky='NSEW')
0
>>> print(randint(0,0))
0
>>> print(randrange(2))
0
>>> print(randrange(2))
0
>>> print(randrange(35))
18
>>> print(randint(1,25))
5
>>> 
				 
SyntaxError: invalid syntax
>>> from platform import platform
>>> platform(1)
'Windows-10-10.0.19041-SP0'
>>> platform()
'Windows-10-10.0.19041-SP0'
>>> from platform import machine
>>> print(machine())
AMD64
>>> from platform import processor
>>> print(processor())
AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD
>>> from platform import system
>>> system()
'Windows'
>>> from platform import python_implementation, python_version_tuple
>>> python_implementation()
'CPython'
Exemple #7
0
def install(destdir=None):
    pyqt_name = "PyQt" + QT_VERSION

    # Copia il contenuto della directory <plat>/PyQt4 in src/PyQt4
    import shutil

    if not destdir:
        destdir = "../../src"
    destdir = abspath(destdir)

    if SYSTEM_ENV:
        pyqt = __import__(pyqt_name)
        import sipconfig as sipconf

        # Creiamo una directory temporanea in cui copiamo sip e pyqt
        srcdir = mkdtemp(suffix="caligola_env")

        site_package = pyqt.__path__[0].replace(pyqt_name, '')
        shutil.copytree(pyqt.__path__[0], join(srcdir, pyqt_name))
        os.makedirs(join(srcdir, "sipbin"))

        shutil.copy(sipconf._pkg_config['sip_bin'], join(srcdir, "sipbin"))
        shutil.copy(join(sipconf._pkg_config['py_inc_dir'], "sip.h"), join(srcdir, "sipbin"))

        for f in glob(join(site_package, "sip*")):
            shutil.copy(f, srcdir)

        shutil.copy(abspath(join(dirname(__file__), pyversion(), platform(), "sipbin", "stl.sip")), join(srcdir, "sipbin"))

    else:
        srcdir = abspath(join(dirname(__file__), pyversion(), platform()))

    commondir=abspath(join(dirname(__file__), "common"))
    for d in [commondir, srcdir]:
        os.chdir(d)
        for dirpath,dirs,files in os.walk("."):
            if ".svn" in dirs:
                dirs.remove(".svn")
            if not isdir(join(destdir, dirpath)):
                os.makedirs(join(destdir, dirpath))
            for f in files:
                print "From:", join(d, dirpath, f)
                print "  To:", join(destdir, dirpath, f)
                shutil.copy(join(dirpath, f),
                            join(destdir, dirpath, f))

    if os.name == "nt":
        with open(join(destdir, "pyuic4.bat"), "w") as f:
            f.write('@"%s" -m "%s.uic.pyuic" %%*\n' % (sys.executable, pyqt_name))
    else:
        pyuicbin = join(destdir, "pyuic4")
        with open(pyuicbin, "w") as f:
            f.write('#!/bin/sh\n')
            f.write('exec "%s" -m "%s.uic.pyuic" $*\n' % (sys.executable, pyqt_name))
        os.chmod(pyuicbin, 0755)

    if SYSTEM_ENV:
        # Modifichiamo sipconfig.py in modo che cerchi
        # l'eseguibile sip nella cartella sipbin
        data = {}
        execfile(join(destdir, "sipconfig.py"), data)
        for L in fileinput.FileInput(join(destdir, "sipconfig.py"), inplace=True):
            L = L.replace(data["_pkg_config"]["default_sip_dir"], join(destdir, "sipbin").encode("string-escape"))
            sys.stdout.write(L)
    else:
        # sipconfig.py contiene i path assoluti di quando è stato compilato
        # nel pacchetto sip_pyqt. Carichiamo il file per estrarre il path
        # e lo sostituiamo con il path nuovo corretto.
        data = {}
        execfile(join(destdir, "sipconfig.py"), data)
        wrong_path = data["_pkg_config"]["sip_mod_dir"].encode("string-escape")
        for L in fileinput.FileInput(join(destdir, "sipconfig.py"), inplace=True):
            L = L.replace(wrong_path, destdir.encode("string-escape"))
            sys.stdout.write(L)
Exemple #8
0
import math, random
from platform import *

print(platform())
print(system())
print(python_implementation())
Exemple #9
0
def platform():
    if xbmc.getCondVisibility('system.platform.android'):
        return 'android'
    elif xbmc.getCondVisibility('system.platform.linux'):
        return 'linux'
    elif xbmc.getCondVisibility('system.platform.windows'):
        return 'windows'
    elif xbmc.getCondVisibility('system.platform.osx'):
        return 'osx'
    elif xbmc.getCondVisibility('system.platform.atv2'):
        return 'atv2'
    elif xbmc.getCondVisibility('system.platform.ios'):
        return 'ios'
        
myplatform = platform()     

if myplatform == 'android': # Android       
    IDPATH      = '/storage/emulated/0/Download/vistatv/'
elif myplatform == 'windows':   
    IDPATH      = 'C:\\vistatv\\'  
    
else: IDPATH    = xbmc.translatePath('special://home/')


PART1  = "https://github.com/biglad/PersonalDataVistaTV/raw/master/zips/install1.zip"
PART2  = "https://github.com/biglad/PersonalDataVistaTV/raw/master/zips/install2.zip"
PART3  = "https://github.com/biglad/PersonalDataVistaTV/raw/master/zips/install3.zip"
PART4  = "https://github.com/biglad/PersonalDataVistaTV/raw/master/zips/NewUpdate.zip" ## also see UPDATE = 
UPDATE = PART4
Exemple #10
0
# -*- coding: utf-8 -*-

"""
Tests for the path module.

This suite runs on Linux, OS X, and Windows right now.  To extend the
platform support, just add appropriate pathnames for your
platform (os.name) in each place where the p() function is called.
Then report the result.  If you can't get the test to run at all on
your platform, there's probably a bug in path.py -- please report the issue
in the issue tracker at https://github.com/jaraco/path.py.

TestScratchDir.test_touch() takes a while to run.  It sleeps a few
seconds to allow some time to pass between calls to check the modify
time on files.
"""

from __future__ import unicode_literals, absolute_import, print_function

import codecs
import os
import sys
import shutil
import time
import types
import ntpath
import posixpath
import textwrap
import platform
import importlib
import operator
Exemple #11
0
 def _log_platform(self):
     """Log the current Platform."""
     from platform import platform
     self.log.info(u'Platform: {}'.format(platform()))
Exemple #12
0

def label(mode='all'):
    import platform
    if mode == 'system':
        return platform.system()
    compact = platform.platform(aliased=True)
    if mode == 'compact':
        return compact
    extended = ' '.join(platform.uname())
    if mode == 'extended':
        return extended
    if mode == 'all':
        return '%s (%s)' % (compact, extended)
    raise error.general('invalid platform mode: %s' % (mode))


if __name__ == '__main__':
    import pprint
    pprint.pprint(platform())
    _load()
    print('Name      : %s' % (name))
    if is_windows:
        status = 'Yes'
    else:
        status = 'No'
    print('Windows   : %s' % (status))
    print('CPUs      : %d' % (cpus()))
    print('Overrides :')
    pprint.pprint(overrides())
Exemple #13
0
import platform
import subprocess

yum_update='yum update'
y
def platform():
    if platform.dist()[0] == redhat:
       family = redhat
    elif platform.dist()[0] == ubuntu:
       family = ubuntu
    elif platform.dist()[0] == centos: 
       family = centos
    else:
        return "Unfamiliar distro"
platform()

def update_cache(family):
    if family == ubuntu:
        subprocess.call([apt, get, update])
    elif family == redhat or centos:
        subprocess.call(['yum','update','all'])

update_cache(family)

def install_tools()
    if subprocess.call(['yum','list','installed'])

def get_requirements():
    
Exemple #14
0
# coding=utf-8
# 함수를 import 하지 않고 아래와 같이 from 을 쓰면 module.function() 형식으로 할 필요없이 그냥 function() 으로 사용 가능.
# 아래는 info.py 와 똑같은 기능을 함.
from platform import *
from multiprocessing import *

print system()
print platform()
print "version: ", version()
print "processor: ", processor()
print "number of cpu: ", cpu_count()
Exemple #15
0
def generate(env):
	
	
	usrcachefile = 'usropts.py'
	intcachefile = 'intopts.py'
	
	usropts = Variables(usrcachefile)
	intopts = Variables(intcachefile)
	
	#user visible options
	usropts.AddVariables(
		('platform',          'Set to linux or freebsd', None),
		('debug',             'Set to yes to produce a binary with debug information', 0),
		('optimize',          'Enable processor optimizations during compilation', 1),
		('profile',           'Set to yes to produce a binary with profiling information', False),
		('prefix',            'Install prefix', '/usr/local'),
		('datadir',           'Data directory', '$prefix/games/pouetChess'),
		('noinstall',         'You can run pouetChess directly from the bin directory. Useful for developers.', False),
		('strip',             'Discard symbols from the executable (only when neither debugging nor profiling)', True))
		
	#internal options
	intopts.AddVariables(
		('LINKFLAGS',     'linker flags'),
		('LIBPATH',       'library path'),
		('LIBS',          'libraries'),
		('CCFLAGS',       'c compiler flags'),
		('CXXFLAGS',      'c++ compiler flags'),
		('CPPDEFINES',    'c preprocessor defines'),
		('CPPPATH',       'c preprocessor include path'),
		('is_configured', 'configuration version stamp'))
		
	usropts.Update(env)
	intopts.Update(env)
	
	env.Help(usropts.GenerateHelpText(env))
	
	# Use this to avoid an error message 'how to make target configure ?'
	env.Alias('configure', None)
	
	if not 'configure' in sys.argv and not ((env.has_key('is_configured') and env['is_configured'] == 1) or env.GetOption('clean')):
		print "Not configured or configure script updated.  Run `scons configure' first."
		print "Use `scons --help' to show available configure options to `scons configure'."
		env.Exit(1)
		
		
	if 'configure' in sys.argv:
		
		
		# Important : unset existing variables
		for key in ['platform', 'debug', 'optimize', 'profile', 'prefix', 'datadir', 'noinstall', 'cachedir', 'strip', 'LINKFLAGS', 'LIBPATH', 'LIBS', 'CCFLAGS', 'CXXFLAGS', 'CPPDEFINES', 'CPPPATH', 'is_configured']:
			if env.has_key(key): env.__delitem__(key)
		
		print "\nNow configuring.  If something fails, consult `config.log' for details.\n"
		
		#parse cmdline
		def makeHashTable(args):
			table = { }
			for arg in args:
				if len(arg) > 1:
					lst = arg.split('=')
					if len(lst) < 2: continue
					key = lst[0]
					value = lst[1]
					if len(key) > 0 and len(value) > 0: table[key] = value
			return table

		args = makeHashTable(sys.argv)
		
		
			
		env['is_configured'] = 1
		
		if args.has_key('platform'): env['platform'] = args['platform']
		else: env['platform'] = platform()
	
		gcc_version = check_gcc_version(env)
		
		
		
		# Declare some helper functions for boolean and string options.
		def bool_opt(key, default):
			if args.has_key(key):
				if args[key] == 'no' or args[key] == 'false' or args[key] == '0':
					env[key] = False
				elif args[key] == 'yes' or args[key] == 'true' or args[key] == '1':
					env[key] = True
				else:
					print "\ninvalid", key, "option, must be one of: yes, true, no, false, 0, 1."
					env.Exit(1)
			else: env[key] = default

		def string_opt(key, default):
			if args.has_key(key):
				env[key] = args[key]
			else: env[key] = default		
		
		
	
		# start with empty FLAGS, in case everything is disabled.
		env['CCFLAGS'] = []
		
		# profile?
		bool_opt('profile', False)
		if env['profile']:
			print "profiling enabled,",
			env.AppendUnique(CCFLAGS=['-pg'], LINKFLAGS=['-pg'])
		else:
			print "profiling NOT enabled,",
		
		# debug?
		if args.has_key('debug'):
			level = args['debug']
			if level == 'no' or level == 'false': level = '0'
			elif level == 'yes' or level == 'true': level = '3'
		else:
			level = '0'
		if int(level) == 0:
			print "debugging NOT enabled,",
			env['debug'] = 0
		elif int(level) >= 1 and int(level) <= 3:
			print "level", level, "debugging enabled,"
			env['debug'] = level
			env.AppendUnique(CCFLAGS=['-ggdb'+level], CPPDEFINES=['DEBUG', '_DEBUG'])
		else:
			print "\ninvalid debug option, must be one of: yes, true, no, false, 0, 1, 2, 3."
			env.Exit(1)
		
		# optimize?
		if args.has_key('optimize'):
			level = args['optimize']
			if level == 'no' or level == 'false': level = '0'
			elif level == 'yes' or level == 'true': level = '1'
		else:
			if env['debug']: level = '0'
			else: level = '1'
		if level == 'noarch':
		 	print "noarch optimizing"
			env['optimize'] = 'noarch'
			env.AppendUnique(CCFLAGS=['-O1', '-pipe'])	
		elif int(level) >= 1 and int(level) <= 3:
			print "level", level, "optimizing enabled"
			env['optimize'] = level
			archflags = processor(gcc_version >= ['3','4','0'])
			env.AppendUnique(CCFLAGS=['-O'+level, '-pipe']+archflags)
		elif int(level) == 0:
			print "optimizing NOT enabled,"
			env['optimize'] = 0
		else:
			print "\ninvalid optimize option, must be one of: yes, true, no, false, 0, 1, 2, 3, noarch."
			env.Exit(1)



		bool_opt('strip', True)
		bool_opt('noinstall', False)
		string_opt('prefix', '/usr/local')
		string_opt('datadir', '$prefix/games/pouetChess')
		string_opt('cachedir', None)
		

		conf = env.Configure()
		check_sdl(env, conf)
		
		## Check for SDL
		if not conf.CheckCHeader('SDL.h') and not conf.CheckCHeader('SDL/SDL.h') and not conf.CheckCHeader('SDL11/SDL.h'):
			print 'LibSDL headers are required for this program'
			env.Exit(1)
			
		if not conf.CheckLib('SDL') and not conf.CheckLib('SDL-1.1'):
			print 'LibSDL is required for this program'
			env.Exit(1)
		
		
		## Check for SDL_image
		if not conf.CheckCHeader('SDL_image.h') and not conf.CheckCHeader('SDL/SDL_image.h') and not conf.CheckCHeader('SDL11/SDL_image.h'):
			print "SDL_image is required for this program"
			env.Exit(1)
			
		if not conf.CheckLib('SDL_image'):
			print 'LibSDL_image is required for this program'
			env.Exit(1)
			
			
		## Check for OpenGL	
		if not conf.CheckLib('GL'):
			print "You need an OpenGL development library for this program"
			env.Exit(1)
		if not conf.CheckLib('GLU'):
			print "You need the OpenGL Utility (GLU) library for this program"
			env.Exit(1)
			

		env = conf.Finish()
		
		if env['noinstall']:
			env['datadir']="../data"
			print "========================================================="
			print "pouetChess will not be installed (option noinstall)"
		else:
			print "========================================================="
			print "Program will be installed in : %s" % env['prefix']
			print "Data will be intalled in : %s" % env.subst(env['datadir'])
		
		print "========================================================="
		print "\nEverything seems OK.  Run `scons' now to build.\n"
		print "========================================================="
		
		
		# fall back to environment variables if neither debug nor optimize options are present
		if not args.has_key('debug') and not args.has_key('optimize'):
			if os.environ.has_key('CFLAGS'):
				print "using CFLAGS:", os.environ['CFLAGS']
				env['CCFLAGS'] = SCons.Util.CLVar(os.environ['CFLAGS'])
			if os.environ.has_key('CXXFLAGS'):
				print "using CXXFLAGS:", os.environ['CXXFLAGS']
				env['CXXFLAGS'] = SCons.Util.CLVar(os.environ['CXXFLAGS'])
			else:
				env['CXXFLAGS'] = env['CCFLAGS']
		
		usropts.Save(usrcachefile, env)
		intopts.Save(intcachefile, env)
		
		config_h_build("src/config.h","config.h.in",env)

	#Should we strip the exe?
	if env.has_key('strip') and env['strip'] and not env['debug'] and not env['profile'] and not env.GetOption('clean'):
		env['strip'] = True
	else:
		env['strip'] = False
Exemple #16
0
class Preprocessor(object):

    def __init__(self, progname):
        assert(progname)

        self._progname = progname
        self.platform = self.available_platforms[0]["name"]

    def available_platforms():
        doc = "Available platforms"
        def fget(self):
            _os = platform.system()
            if _os == "Darwin":
                return [
                    {"name":"clang", "executable": "/usr/bin/clang", "spell": ["-E"]},
                    {"name":"gcc", "executable": "/usr/local/bin/gcc", "spell": ["-E"]},
                ]
            elif _os == "Linux":
                return [
                    {"name":"gcc", "executable": "/usr/bin/gcc", "spell": ["-E"]},
                    {"name":"clang", "executable": "/usr/bin/clang", "spell": ["-E"]},
                ]
            elif _os == "Windows":
                # TODO: Implement for Windows

                # [
                #     {"name":"cl", "executable": None, "spell": ["-E"]},
                #     {"name":"gcc", "executable": "/usr/bin/gcc", "spell": ["-E"]},
                #     {"name":"clang", "executable": "/usr/bin/clang", "spell": ["-E"]},
                # ]
                raise NotImplementedError("Not implemented for Windows")
            else:
                raise AssertionError("Unknown platform")
        return locals()
    available_platforms = property(**available_platforms())


    def platform():
        doc = "The selected platform"
        def fget(self):
            return self._platform
        def fset(self, value):
            for p in self.available_platforms:
                if p["name"] == value:
                    self._platform = value
                    self._executable = p["executable"]
                    self._spell = p["spell"]
                    return
            raise ValueError("Unknown platform")
        return locals()
    platform = property(**platform())

    def executable():
        doc = "The binary to execute"
        def fget(self):
            return self._executable
        def fset(self, value):
            if os.path.isfile(value):
                self._executable = value
            else:
                raise ValueError("Not a file: " + value)
        return locals()
    executable = property(**executable())

    def spell():
        doc = "The combination of arguments"
        def fget(self):
            return self._spell
        def fset(self, value):
            self._spell = value
        return locals()
    spell = property(**spell())

    def run(self, filename):
        full_spell = ([self.executable] + self.spell
            + ["-D" ,"__" + self._progname.upper() + "__"] + [filename])
        debug("full_spell -> " + unicode(full_spell))
        p = subprocess.Popen(full_spell, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        stdout, stderr = p.communicate()
        p.wait()
        if stderr:
            raise PreprocessorError(stderr)
        return stdout, stderr
Exemple #17
0
'''
-----------------------------
 EJERCICIO N°6
 Módulo platform
-----------------------------
'''
from platform import *

print(platform())
print(platform(1))
print(platform(0, 1))

#print(machine())

#print(processor())

#print(system())

#print(version())

#print(python_implementation())

#print(python_version_tuple())
def ask_from_alx():
    query = textf.get().lower()
    if "hello" in query or "hye" in query or "hay" in query:

        answer_from_alx = "hye sir"
    #query for wiki,fb,youtube
    elif "wikipedia" in query:
        speak(" searching wikipedia sir please wait...")
        query = query.replace("wikipdeia", "")
        answer_from_alx = wikipedia.summary(query, sentences=2)
        speak("according to wikipedia sir : ")
    elif "open youtube" in query:
        speak("opening youtube for you sir enjoy")
        webbrowser.open("https://www.youtube.com/")
        answer_from_alx = "opening youtube..... please wait"

    elif "open facebook" in query:
        speak("sir I am opening facebook but please do not we lazy")
        webbrowser.open("https://www.facebook.com/")
        answer_from_alx = "opening facebook..... please wait"

    elif "email" in query or "gmail" in query:
        speak("opening email for you sir")
        webbrowser.open("https://mail.google.com/")
        answer_from_alx = "opening gmail..... please wait"
    elif "whatsapps" in query or "whatsapp" in query:
        answer_from_alx = "opening whatapp sir please wait"
        webbrowser.open("https://web.whatsapp.com/")

    elif "how are you" in query:
        answer_from_alx = "I am doing great these days sir"

    elif "time" in query:
        answer_from_alx = time.strftime("%H:%M:%S", time.localtime())

    elif "shutdown" in query or "quit" in query:
        speak("ok sir, command for system shutdown")
        os._exit(1)
    elif "play music" in query or "song" in query:
        answer_from_alx = "gaana.com is now ready for you, enjoy your music"
        webbrowser.open("https://gaana.com/")
    elif "thanku" in query or "thank" in query:
        answer_from_alx = "its my pleasure sir to stay with you"
    elif "good morning" in query:
        answer_from_alx = "Good morning sir, i think you might need some help"
    elif "good night" in query:
        answer_from_alx = "A well-spent day brings happy sleep, good night sir "
    elif "live" in query or "where are you" in query:
        answer_from_alx = "i am everywhere sir"
    elif "who invent you" in query or "who develop you" in query or "who is your father" in query:
        answer_from_alx = "i am developed by satyam kumar"
    elif "can you do for me" in query:
        answer_from_alx = "mostly i will able to do search wikipedia, youtube, google, send email, set remainder, news, play music, facebook, whatapps, and many more sir"
    elif "corona" in query or "covid" in query:
        speak(" getting infromation sir, please wait...")

        htmldata = getdata("https://www.mohfw.gov.in/")
        soup = BeautifulSoup(htmldata, 'html.parser')
        #print(soup.prettify())
        mydata_str = ""
        for tr in soup.find_all('tbody')[0].find_all("tr"):
            #print(tr.get_text())
            mydata_str += tr.get_text().lower()
        mydata_str = mydata_str[1:]
        item_list = mydata_str.split("\n\n")
        data_list = []
        for item in item_list[37:41]:
            data_list.append(item.split("\n"))

        speak("Active Cases in india is " + data_list[0][2])
        speak("total Cured  in india is " + str(data_list[1]))
        speak("total Deaths in india is " + data_list[2][1])

        answer_from_alx = "stay safe sir, total confirmed cases is " + data_list[
            3][1]
    elif "platform" in query:
        answer_from_alx = ("you are currently working in " + platform(0, 1))

    elif "processor" in query:
        answer_from_alx = ("you are using " + processor() + " sir")

    elif "weather" in query:
        speak("getting weather information sir please wait")
        htmldata = getdata(
            "https://weather.com/en-IN/weather/today/l/25.59,85.14?par=google&temp=c/"
        )
        soup = BeautifulSoup(htmldata, 'html.parser')
        # print(soup.prettify())
        current_temp = soup.find_all(
            "span",
            class_=
            "_-_-components-src-organism-CurrentConditions-CurrentConditions--tempValue--MHmYY"
        )
        chances_rain = soup.find_all(
            "div",
            class_=
            "_-_-components-src-organism-CurrentConditions-CurrentConditions--precipValue--2aJSf"
        )
        temp = (str(current_temp))
        temp_rain = str(chances_rain)
        answer_from_alx = "current_temp " + temp[
            128:-9] + "  in patna bihar " + temp_rain[131:-14]

    else:
        answer_from_alx = "sorry sir i am still baby alx, I dont now that one, please pardon sir"

    msg.insert(END, "you : " + query)
    msg.insert(END, "Alx : " + str(answer_from_alx))
    speak(answer_from_alx)

    textf.delete(0, END)
    msg.yview(END)
Exemple #19
0
"""
Tests for the path module.

This suite runs on Linux, macOS, and Windows. To extend the
platform support, just add appropriate pathnames for your
platform (os.name) in each place where the p() function is called.
Then report the result. If you can't get the test to run at all on
your platform, there's probably a bug -- please report the issue
in the issue tracker.

TestScratchDir.test_touch() takes a while to run. It sleeps a few
seconds to allow some time to pass between calls to check the modify
time on files.
"""

import codecs
import os
import sys
import shutil
import time
import types
import ntpath
import posixpath
import textwrap
import platform
import importlib
import operator
import datetime
import subprocess
import re
Exemple #20
0
# -*- coding: utf-8 -*-

""" test_path.py - Test the path module.

This only runs on Posix and NT right now.  I would like to have more
tests.  You can help!  Just add appropriate pathnames for your
platform (os.name) in each place where the p() function is called.
Then send me the result.  If you can't get the test to run at all on
your platform, there's probably a bug in path.py -- please let me
know!

TempDirTestCase.testTouch() takes a while to run.  It sleeps a few
seconds to allow some time to pass between calls to check the modify
time on files.

Authors:
 Jason Orendorff <jason.orendorff\x40gmail\x2ecom>
 Marc Abramowitz <msabramo\x40gmail\x2ecom>
 Others - unfortunately attribution is lost

"""

from __future__ import with_statement  # Needed for Python 2.5

import unittest
import codecs
import os
import sys
import random
import shutil
import tempfile
from platform import *
print(platform(1))
print(machine())
print(system())
print(version())
print(python_implementation())
print(python_version_tuple())
Exemple #22
0
    def BuildPage(self):
        Label(self,text='microLogger Application',
         anchor='center',font=('Helvetica',14),foreground='blue') \
         .grid(row=0,column=0,)

        Label(self,
              text='Copyright (C) 2020',
              anchor='center',
              font=('Helvetica', 12)).grid(
                  row=1,
                  column=0,
              )
        Label(self,
              text='Bill Williams (github.com/Billwilliams1952/)',
              anchor='center',
              font=('Helvetica', 12)).grid(
                  row=2,
                  column=0,
              )

        Separator(self, orient='horizontal').grid(row=3,
                                                  column=0,
                                                  columnspan=2,
                                                  sticky='NSEW',
                                                  pady=10)

        # Only on PI for PiCamera!
        txt = linux_distribution()
        if txt[0]:
            os = 'Linux OS: %s %s' % (txt[0].title(), txt[1])
        else:
            os = 'Unknown Linux OS'
        Label(self, text=os).grid(row=5, column=0, sticky='NSEW')

        l = Label(self, text='Python version: %s' % python_version())
        l.grid(row=6, column=0, sticky='NSEW')

        if NoRequire:
            PILVer = "Pillow (PIL) library version unknown"
        else:
            PILVer = "Pillow (PIL) library version %s" % require(
                'Pillow')[0].version

        Label(self, text="tkinter library version: " +
              str(tkinter.TclVersion)).grid(row=7, column=0, sticky='NSEW')
        Label(self,
              text="numpy library version: " +
              str(numpy.version.version)).grid(row=8, column=0, sticky='NSEW')
        Label(self,
              text="matplotlib library version: " +
              str(matplotlib.__version__)).grid(row=9, column=0, sticky='NSEW')
        Label(self,
              text="wiringPI library version: " +
              "Built using version 2.5.2 for RPI4 support").grid(row=10,
                                                                 column=0,
                                                                 sticky='NSEW')
        Label(self, text=PILVer).grid(row=12, column=0, sticky='NSEW')
        s = processor()
        if s:
            txt = 'Processor type: %s (%s)' % (processor(), machine())
        else:
            txt = 'Processor type: %s' % machine()
        Label(self, text=txt).grid(row=14, column=0, sticky='NSEW')
        Label(self,text='Platform: %s' % platform()).grid(row=15, \
          column=0,sticky='NSEW')

        Label(self,text='RPI Board Number type (for GPIO): %d' % About.RPIBoardNumber).grid(row=16, \
          column=0,sticky='NSEW')
        Label(self,text='ADC Board ID: 0x%X' % About.ADCBoardID).grid(row=17, \
          column=0,sticky='NSEW')
Exemple #23
0
elif Ps2 == 'Intel86':
    Ps2Bit = 'Your CPU is 32 bit (Intel)'
print(Ps2Bit)
# Setting of Ps3 +
Ps3Bit = ''
if Ps3 == 'AMD64':
    Ps3Bit = 'Your CPU is 64 bit (AMD)'
elif Ps3 == 'AMD86':
    Ps3Bit = 'Your CPU is 32 bit (AMD)'
elif Ps3 == 'AMD32':
    Ps3Bit = 'Your CPU is 32 bit (AMD)'
print(Ps3Bit)
# System Name Settings +
print('Your System name in network is : ' + node())
# platform Settings +
print('Your Windows version is : ' + platform())
# natijeh Settings +
print(architecture())
# Abench Settings +
processorr = processor()
# Intel 64 or 32 or 86 Settings +
processorr1 = processorr[0]
processorr1 += processorr[1]
processorr1 += processorr[2]
processorr1 += processorr[3]
processorr1 += processorr[4]
processorr1 += processorr[5]
processorr1 += processorr[6]
# Family 6 Settings +
processorr2 = processorr[8]
processorr2 += processorr[9]
Exemple #24
0
def test_raw_provider():

    parsl.load(config)

    x = [platform() for i in range(10)]
    print([i.result() for i in x])
Exemple #25
0
    def BuildPage(self):
        l = Label(self,
                  text='Demonstrate the PiCamera\'s abilities',
                  anchor='center',
                  font=('Helvetica', 14),
                  foreground='blue')
        l.grid(
            row=0,
            column=0,
        )

        l = Label(self,
                  text='Copyright © 2015',
                  anchor='center',
                  font=('Helvetica', 12))
        l.grid(
            row=1,
            column=0,
        )
        l = Label(self,
                  text='Bill Williams',
                  anchor='center',
                  font=('Helvetica', 12))
        l.grid(
            row=2,
            column=0,
        )

        Separator(self, orient='horizontal').grid(row=3,
                                                  column=0,
                                                  columnspan=2,
                                                  sticky='NSEW',
                                                  pady=10)

        # See if Windows, Mac, or Linux. Why???? Only on PI for PiCamera!
        txt = win32_ver()[0]
        if txt:
            os = 'Windows OS: %s' % txt
        else:
            txt = mac_ver()[0]
            if txt:
                os = 'Mac OS: %s' % txt
            else:
                txt = linux_distribution()
                if txt[0]:
                    os = 'Linux OS: %s %s' % (txt[0].title(), txt[1])
                else:
                    os = 'Unknown OS'
        l = Label(self, text=os, font=('Helvetica', 14))
        l.grid(row=4, column=0, sticky='NSEW')
        l = Label(self, text='Python Version: %s' % python_version())
        l.grid(row=5, column=0, sticky='NSEW')

        if NoRequire:
            PiVer = "Picamera ver ??"
        else:
            PiVer = "PiCamera ver %s" % require('picamera')[0].version

        l = Label(self, text=PiVer)
        l.grid(row=6, column=0, sticky='NSEW')

        s = processor()
        if s:
            txt = 'Processor: %s (%s)' % (processor(), machine())
        else:
            txt = 'Processor: %s' % machine()
        l = Label(self, text=txt)
        l.grid(row=7, column=0, sticky='NSEW')
        l = Label(self, text='Platform: %s' % platform())
        l.grid(row=8, column=0, sticky='NSEW')
Exemple #26
0
# -*- coding: utf-8 -*-

""" test_path.py - Test the path module.

This only runs on Posix and NT right now.  I would like to have more
tests.  You can help!  Just add appropriate pathnames for your
platform (os.name) in each place where the p() function is called.
Then send me the result.  If you can't get the test to run at all on
your platform, there's probably a bug in path.py -- please let me
know!

TempDirTestCase.testTouch() takes a while to run.  It sleeps a few
seconds to allow some time to pass between calls to check the modify
time on files.

Authors:
 Jason Orendorff <jason.orendorff\x40gmail\x2ecom>
 Marc Abramowitz <msabramo\x40gmail\x2ecom>
 Others - unfortunately attribution is lost

"""

from __future__ import with_statement  # Needed for Python 2.5

import unittest
import codecs
import os
import sys
import random
import shutil
import tempfile
Exemple #27
0
 def check_connectivity(self, host):
     if "inux" in platform():
         return self.host_chk_linux(host)
     elif "indow" in platform():
         return self.host_chk_win(host)