예제 #1
0
파일: dep_conf.py 프로젝트: lonicera/Peynir
def dependencies(source,action):
    text.text_formatting(_(">> Resolving dependencies.."), 0, 'info')
    root = functions.get_root(cons.sprpckg_dir+source+".xml")
    #Bağımlılıklar çözülüyor
    dependcount = len(root[2])
    dependencies = root[2]
    if dependcount > 0:
        text.text_formatting(str(dependcount) + _(" dependencies have found."), 1, 'info')
        #Tamamen kaldırma işlemi için ....
        if action == "remove":
            text.text_formatting(_("Following suprapackage(s) will remove. "), 1, 'info')
            for dep in root[2]:
                try:
                    text.text_formatting(dep.text + " ==> " + get_description(dep.text), 1, 'info')
                except:
                    text.text_formatting(dep.text + _(" ==> There is no description for this suprapackage"), 1, 'warning')
            if cons.confm:
                answer = _("Y")
            else:
                answer = input(_("Are you want to remove these suprapackages (Y/N): "))
                answer = answer.upper()
            if answer == _("Y"):
                for dep in root[2]:
                    package = dep.text
                    functions.remove(package,"skip",source)
            else:
                text.text_formatting(_("Dependencies coulnd't removed so remove process couldn't continue."), 0, 'error')
                sys.exit(1)
        else:
            text.text_formatting(_("Following suprapackage(s) will install. "), 0, 'info')
            for dep in root[2]:
                if not search.srch_pynr(dep.text,'Peynir/Name','absolute') and not suprapackage_check(str(dep.text)):
                    text.text_formatting(dep.text + _(" couldn't found in repository, you can install it manually"), 1, 'warning')
                    os.remove(cons.sprpckg_dir + source + ".xml")
                    sys.exit(1)
                else:
                    try:
                        text.text_formatting(dep.text + " ==> " + get_description(dep.text), 1, 'info')
                    except:
                        text.text_formatting(dep.text + _(" ==> There is no description for this suprapackage"), 1, 'info')
            if cons.confm:
                answer = _("Y")
            else:
                answer = input(_("Are you want to install these suprapackages (Y/N): "))
                answer = answer.upper()
            if answer == _("Y"):
                for dep in root[2]:
                    package = dep.text
                    if not functions.suprapackage_check(package):
                        functions.install(package,"","") #İç içe bağımlılık sorunu olacak o neden ilave bir fonksiyon paramatresi ise bu soruyu bir kez sordurulabilir
                    else:
                        text.text_formatting(">> " + package + _(" is already installed"), 0, 'info')
                    mdfy.modify_add(cons.sprpckg_dir+package+".xml","<Dependencies","'>"," " + source,"previous") 
            else:
                os.remove(cons.sprpckg_dir+source+".xml")
                text.text_formatting(_("Dependencies coulnd't installed so install process couldn't continue."), 0, 'error')
                sys.exit(1)
    else:
        text.text_formatting(_("There is a no dependencies"), 1, 'info')
예제 #2
0
파일: api.py 프로젝트: byackee/LISA
    def install(self, request, **kwargs):
        self.method_check(request, allowed=['post','get'])
        self.is_authenticated(request)
        self.throttle_check(request)

        plugin_url = request.POST.get("url")
        plugin_sha = request.POST.get("sha")
        plugin_name = kwargs['plugin_name']
        status = functions.install(plugin_url=plugin_url, plugin_sha=plugin_sha, plugin_name=plugin_name)

        self.log_throttled_access(request)
        LisaInstance.SchedReload()
        LisaInstance.LisaReload()
        return self.create_response(request, status, HttpCreated)
예제 #3
0
def dependencies(source, action):
    text.text_formatting(_(">> Resolving dependencies.."), 0, 'info')
    root = functions.get_root(cons.sprpckg_dir + source + ".xml")
    #Bağımlılıklar çözülüyor
    dependcount = len(root[2])
    dependencies = root[2]
    if dependcount > 0:
        text.text_formatting(
            str(dependcount) + _(" dependencies have found."), 1, 'info')
        #Tamamen kaldırma işlemi için ....
        if action == "remove":
            text.text_formatting(_("Following suprapackage(s) will remove. "),
                                 1, 'info')
            for dep in root[2]:
                try:
                    text.text_formatting(
                        dep.text + " ==> " + get_description(dep.text), 1,
                        'info')
                except:
                    text.text_formatting(
                        dep.text +
                        _(" ==> There is no description for this suprapackage"
                          ), 1, 'warning')
            if cons.confm:
                answer = _("Y")
            else:
                answer = input(
                    _("Are you want to remove these suprapackages (Y/N): "))
                answer = answer.upper()
            if answer == _("Y"):
                for dep in root[2]:
                    package = dep.text
                    functions.remove(package, "skip", source)
            else:
                text.text_formatting(
                    _("Dependencies coulnd't removed so remove process couldn't continue."
                      ), 0, 'error')
                sys.exit(1)
        else:
            text.text_formatting(_("Following suprapackage(s) will install. "),
                                 0, 'info')
            for dep in root[2]:
                if not search.srch_pynr(dep.text, 'Peynir/Name',
                                        'absolute') and not suprapackage_check(
                                            str(dep.text)):
                    text.text_formatting(
                        dep.text +
                        _(" couldn't found in repository, you can install it manually"
                          ), 1, 'warning')
                    os.remove(cons.sprpckg_dir + source + ".xml")
                    sys.exit(1)
                else:
                    try:
                        text.text_formatting(
                            dep.text + " ==> " + get_description(dep.text), 1,
                            'info')
                    except:
                        text.text_formatting(
                            dep.text +
                            _(" ==> There is no description for this suprapackage"
                              ), 1, 'info')
            if cons.confm:
                answer = _("Y")
            else:
                answer = input(
                    _("Are you want to install these suprapackages (Y/N): "))
                answer = answer.upper()
            if answer == _("Y"):
                for dep in root[2]:
                    package = dep.text
                    if not functions.suprapackage_check(package):
                        functions.install(
                            package, "", ""
                        )  #İç içe bağımlılık sorunu olacak o neden ilave bir fonksiyon paramatresi ise bu soruyu bir kez sordurulabilir
                    else:
                        text.text_formatting(
                            ">> " + package + _(" is already installed"), 0,
                            'info')
                    mdfy.modify_add(cons.sprpckg_dir + package + ".xml",
                                    "<Dependencies", "'>", " " + source,
                                    "previous")
            else:
                os.remove(cons.sprpckg_dir + source + ".xml")
                text.text_formatting(
                    _("Dependencies coulnd't installed so install process couldn't continue."
                      ), 0, 'error')
                sys.exit(1)
    else:
        text.text_formatting(_("There is a no dependencies"), 1, 'info')
예제 #4
0
import functions as func

#Arduino ühendusel output PATH oleks siis arduino inner ssd drive

#Force install pyenchant
func.install("pyenchant")

#Set up enchant spellchecker and dictionary
chkr = func.SpellChecker("en_US", filters=[func.EmailFilter, func.URLFilter])
d = func.enchant.Dict("en_US")

#Ready a output file
outputFile = "results.txt"
func.clearFile(outputFile)

#Let user choose folder or file
userChoice = "None"
while userChoice != "F" and userChoice != "f" and userChoice != "d" and userChoice != "D":
    userChoice = input(
        "F = Specific file spellcheck, D = Directory wide spellcheck: ")
    if userChoice == "D" or userChoice == "d":
        selectedFolder = func.chooseFolder()
        selectedFiles = func.parseFolder(selectedFolder)
    if userChoice == "F" or userChoice == "f":
        selectedSingleFile = func.chooseFile()
        selectedFiles = []

#Parse files in chosen folder
if userChoice == "d" or userChoice == "D":
    for x in selectedFiles:
        print("File found: " + x)
예제 #5
0
def main():
    if not os.geteuid() == 0:
        sys.exit(
            _("You must be root to run this application, please use sudo and try again."
              ))
    functions.db_file_check()
    parser = argparse.ArgumentParser(
        description=
        '''Suprapackage Manager for Archlinux. It's also a framework for configuring Archlinux or other pacman based distribution.''',
        prog='peynir')
    parser.add_argument(
        "-d",
        "--debug",
        help="Log everyhing (including info, warning and errors)",
        action="store_true")
    parser.add_argument("-S",
                        nargs='*',
                        metavar='Suprapackage',
                        help="Install suprapackage")
    parser.add_argument("-U",
                        metavar='Suprapackage',
                        help="Install local suprapackage")
    parser.add_argument("-R",
                        nargs='*',
                        metavar='Suprapackage',
                        help="Remove suprapackage")
    parser.add_argument("-Rs",
                        nargs='*',
                        metavar='Suprapackage',
                        help="Remove suprapackage and its dependencies")
    parser.add_argument("-Sy", help="Update repository", action="store_true")
    parser.add_argument("-Syy",
                        help="Update peynir and pacman repository",
                        action="store_true")
    parser.add_argument("-Su", help="Upgrade the system", action="store_true")
    parser.add_argument("-Syu", help="Upgrade the system", action="store_true")
    parser.add_argument("-Ss", help="Search suprapackege in repository")
    parser.add_argument("-Qs", help="Search suprapackege in local")
    parser.add_argument(
        "-O", help="Repair system or package (not fully implemented)")
    parser.add_argument("--noconfirm",
                        help="Do not prompt for any confirmation",
                        action="store_true")
    parser.add_argument(
        "--cachedir",
        help=
        "[path] Overrides the default location of the suprapackage cache directory."
    )
    parser.add_argument("--silence", help="No output", action="store_true")

    args = parser.parse_args()

    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(1)
    if args.noconfirm:
        cons.confm = True
    if args.debug:
        cons.debug = True
    if args.silence:
        cons.silence = True
    if args.cachedir:
        cons.cachedir = args.cachedir.strip()
        if not cons.cachedir[len(cons.cachedir) - 1:len(cons.cachedir)] == "/":
            cons.cachedir = cons.cachedir + "/"
            print(cons.cachedir)

    if args.Sy:
        functions.sync_repo(0)
    if args.Syy:
        functions.sync_repo(1)
    if args.Su:
        functions.upgrade()
    if args.Syu:
        functions.sync_repo(1)
        functions.upgrade()
    if args.S:
        functions.db_file_check(
        )  #Burada ve diğer gereksiz kullanımları temizle
        for i in args.S:
            rqst = i.lower()
            if search.srch_pynr(rqst, 'Peynir/Name', 'absolute'):
                functions.install(rqst, "", "")
            else:
                text.text_formatting(
                    'error: ' + rqst + ' no such a suprapackage', 0, "warning")

    if args.R:
        functions.db_file_check()
        for i in args.R:
            rqst = i.lower()
            functions.remove(rqst, "", "")
    if args.Rs:
        functions.db_file_check()
        for i in args.Rs:
            rqst = i.lower()
            functions.remove(rqst, "complete", "")
    if args.Ss:
        functions.db_file_check()
        for i in args.Ss.split():
            rqst = i.lower()
            text.text_formatting("Results for " + rqst, 0, 'info')
            search.srch_pynr(rqst, 'Peynir/Name', 'find')
    if args.Qs:
        functions.db_file_check()
        for i in args.Qs.split():
            rqst = i.lower()
            text.text_formatting("Results for " + rqst, 0, 'info')
            search.local_search(rqst)
    if args.U:
        functions.db_file_check()
        if "/" in args.U:
            position = args.U.rfind('/')
            adress = args.U[:position]
            package = args.U[position + 1:]
        else:
            adress = ""
        if package[-3:] != "xml" and "." in package:
            text.text_formatting(_("Invalid package format"), 0, "error")
            sys.exit(1)
        elif not "." in package:
            package = package + ".xml"

        if not functions.suprapackage_check(package[:-4]):
            functions.install(package, "local", adress)
        else:
            text.text_formatting(
                _(">> This suprapackage already installed in your system."), 0,
                'error')
예제 #6
0
import functions as fc
import time
#Software check, install.
fc.install("requests")
fc.install("selenium")
fc.install("pynput")
fc.install("keyboard")

#Import dependancies
import requests
import keyboard
from selenium import webdriver
from requests.auth import HTTPBasicAuth
from selenium.webdriver.common.keys import Keys

wordsToDetect = [
    'Millal session?', 'next session when', 'millal sess?', 'session when?'
]
running = True

username = str(input("Messenger username? - "))
password = str(input("Messenger password? - "))

driver = fc.login(username, password)

#keyboard.press_and_release("enter")

print(type(driver.page_source))
time.sleep(5)
textAlreadyRespondedto = []
incomingMessages = driver.find_elements_by_class_name("oo9gr5id")
예제 #7
0
파일: peynir.py 프로젝트: lonicera/Peynir
def main():
    if not os.geteuid()==0:
        sys.exit(_("You must be root to run this application, please use sudo and try again."))
    functions.db_file_check()
    parser = argparse.ArgumentParser(description='''Suprapackage Manager for Archlinux. It's also a framework for configuring Archlinux or other pacman based distribution.''', prog='peynir')
    parser.add_argument("-d", "--debug", help="Log everyhing (including info, warning and errors)", action="store_true")
    parser.add_argument("-S", nargs='*', metavar='Suprapackage', help="Install suprapackage")
    parser.add_argument("-U", metavar='Suprapackage', help="Install local suprapackage")
    parser.add_argument("-R", nargs='*', metavar='Suprapackage', help="Remove suprapackage")
    parser.add_argument("-Rs", nargs='*', metavar='Suprapackage', help="Remove suprapackage and its dependencies")
    parser.add_argument("-Sy", help="Update repository", action="store_true")
    parser.add_argument("-Syy", help="Update peynir and pacman repository", action="store_true")   
    parser.add_argument("-Su", help="Upgrade the system", action="store_true")
    parser.add_argument("-Syu", help="Upgrade the system", action="store_true")  
    parser.add_argument("-Ss", help="Search suprapackege in repository")  
    parser.add_argument("-Qs", help="Search suprapackege in local")
    parser.add_argument("-O", help="Repair system or package (not fully implemented)")
    parser.add_argument("--noconfirm", help="Do not prompt for any confirmation", action="store_true")
    parser.add_argument("--cachedir", help="[path] Overrides the default location of the suprapackage cache directory.")
    parser.add_argument("--silence", help="No output", action="store_true")

    args = parser.parse_args()
    
    if len(sys.argv)==1:
        parser.print_help()
        sys.exit(1)
    if args.noconfirm:
        cons.confm = True
    if args.debug:
        cons.debug = True
    if args.silence:
        cons.silence = True
    if args.cachedir:
        cons.cachedir = args.cachedir.strip()
        if not cons.cachedir[len(cons.cachedir)-1:len(cons.cachedir)] == "/":
            cons.cachedir = cons.cachedir+"/"
            print(cons.cachedir)
    
    if args.Sy:
        functions.sync_repo(0)
    if args.Syy:
        functions.sync_repo(1)
    if args.Su:
        functions.upgrade()
    if args.Syu:
        functions.sync_repo(1)
        functions.upgrade()
    if args.S:
        functions.db_file_check() #Burada ve diğer gereksiz kullanımları temizle
        for i in args.S:
            rqst = i.lower()
            if search.srch_pynr(rqst,'Peynir/Name','absolute'):
                functions.install(rqst,"","")
            else:
                text.text_formatting('error: '+ rqst +' no such a suprapackage',0, "warning")
    
    if args.R:
       functions.db_file_check() 
       for i in args.R:
           rqst = i.lower()
           functions.remove(rqst,"","")
    if args.Rs:
       functions.db_file_check() 
       for i in args.Rs:
           rqst = i.lower()
           functions.remove(rqst,"complete","")
    if args.Ss:
       functions.db_file_check() 
       for i in args.Ss.split():
           rqst = i.lower()
           text.text_formatting("Results for " + rqst, 0, 'info')
           search.srch_pynr(rqst,'Peynir/Name','find')
    if args.Qs:
       functions.db_file_check() 
       for i in args.Qs.split():
           rqst = i.lower()
           text.text_formatting("Results for " + rqst, 0, 'info' )
           search.local_search(rqst)
    if args.U:
       functions.db_file_check() 
       if "/" in args.U:
           position = args.U.rfind('/')
           adress = args.U[:position]
           package = args.U[position+1:]
       else:
           adress = ""
       if package[-3:] != "xml" and "." in package:
           text.text_formatting(_("Invalid package format"), 0, "error")
           sys.exit(1)
       elif not "." in package: 
           package = package+".xml"
             
       if not functions.suprapackage_check(package[:-4]):
           functions.install(package,"local",adress)
       else:
           text.text_formatting(_(">> This suprapackage already installed in your system."), 0, 'error')
예제 #8
0
import time
import xml.etree.ElementTree as ET
import functions
import sys
import os

if __name__ == '__main__':

    # Going try to install the modules for the user
    try:
        functions.install('selenium')
        functions.install('BeautifulSoup4')
        functions.install('urllib3')
    except:
        print("Oops, sorry you might have to pip install manually")

    print('\n')


    while 1:
        print("Enter exit to leave...\n")

        cik = input("Please Enter the CIK #: ")


        if cik.lower() == 'exit':
            sys.exit()

        # Prevents invalid input
        try:
            # If input isn't a combination of numbers