Пример #1
0
def main():
    try:
        init.init()
    except Exception as e:
        init.graceful_exit()
        import traceback
        print(traceback.print_exception(*init.sys.exc_info()))
        print("Fatal error!!")
        v = input(prompt)
        if v == '1':
            main()
        elif v == '3':
            init.sys.exit(0)
        else:
            import install
            install.main(install.args)
            main()
    except Exception:
        # Extremely fatal error
        print("ERROR")
Пример #2
0
def main(trunkDir, builfDir, installDir):
  print "Creating .buildinfo file"
  command = ["python", 
             os.path.join(trunkDir, "build_system/win32/createBuildInfoFile.py"), 
             installDir]

  run(command)

  
  print "Copying files from source directory"
  sys.path = [pyBuildDir] + sys.path
  import install
  
  install.main(os.path.join(trunkDir, "build_system/post_build/files_to_copy.txt"),
               trunkDir,
               installDir,
               debug=False,
               overwrite=True,
               link=False,
               optimizeCopy=False,
               developerOnly=False)
Пример #3
0
def main(trunkDir, builfDir, installDir):
    print "Creating .buildinfo file"
    command = [
        "python",
        os.path.join(trunkDir, "build_system/win32/createBuildInfoFile.py"),
        installDir
    ]

    run(command)

    print "Copying files from source directory"
    sys.path = [pyBuildDir] + sys.path
    import install

    install.main(os.path.join(trunkDir,
                              "build_system/post_build/files_to_copy.txt"),
                 trunkDir,
                 installDir,
                 debug=False,
                 overwrite=True,
                 link=False,
                 optimizeCopy=False,
                 developerOnly=False)
Пример #4
0
 def __init__(self):
     for file in self.possible_locations:
         if os.path.isfile(file):
             self.config_file = os.path.normpath(file)
             log('i', 'Using configuration file "%s".' % self.config_file)
             break
     if not self.config_file:
         log('f', 'Could not find any configuration files.')
         try:
             import install
             self.config_file = install.main()
             log('i', 'Starting the installer...')
         except ImportError:
             pass
     
     self._load()
Пример #5
0
    def __init__(self):
        for file in self.possible_locations:
            if os.path.isfile(file):
                self.config_file = os.path.normpath(file)
                log('i', 'Using configuration file "%s".' % self.config_file)
                break
        if not self.config_file:
            log('f', 'Could not find any configuration files.')
            try:
                import install
                self.config_file = install.main()
                log('i', 'Starting the installer...')
            except ImportError:
                pass

        self._load()
Пример #6
0
def run():
    if not util.is_supported():
        print('Sorry, your OS is not supported.')
        if util.on_windows and not util.on_wsl:
            print('Please make sure you are running on a WSL2 shell.')
        return 1

    opt = parser.parse_args()
    run_status = 0
    try:
        if opt.COMMAND == 'show-domain':
            run_status = show_domain.main()

        elif opt.COMMAND == 'install':
            super_check()
            output = install.main(name=opt.name, tag=opt.tag, tld=opt.tld)
            if output == 0:
                print(f'Now you can run "{sys.argv[0]} status" to verify')
            run_status = output

        elif opt.COMMAND == 'uninstall':
            super_check()
            run_status = uninstall.main()

        elif opt.COMMAND == 'tunnel':
            super_check()
            run_status = tunnel.connect()

        else:
            run_status = status.main()
        return run_status

    except Fatal as e:
        print(f'fatal: {e}')
        return 1
    except KeyboardInterrupt:
        print('Keyboard interrupt: exiting.')
        return 1
Пример #7
0
    def compile(self, _compiler_: Compiler, _program_: Program) -> None:
        """
        Compiles and installs the given program with the given compiler

        :param _compiler_: the compiler to use
        :param _program_: the program to compile
        """
        _compiler_.is_configured.wait()
        try:
            with TestRunner.EnvManager(_compiler_, _program_.name):
                error = main([_program_.name], True, 1)
                self.assertFalse(
                    error, "The program {} failed to compile with {}".format(
                        _program_.name,
                        get_global_conf().get("install", "compiler")))

                # Checks that bitcode was indeed created at the correct place
                if _compiler_.bitcode:
                    conf = get_trigger_conf(_program_.name)
                    self.assertTrue(
                        os.path.exists(conf.get_executable() + ".bc"))
        finally:
            _program_.is_installed.set()
Пример #8
0
    def compile(self, _compiler_: Compiler, _program_: Program) -> None:
        """
        Compiles and installs the given program with the given compiler

        :param _compiler_: the compiler to use
        :param _program_: the program to compile
        """
        _compiler_.is_configured.wait()
        try:
            with TestRunner.EnvManager(_compiler_, _program_.name):
                error = main([_program_.name], True, 1)
                self.assertFalse(
                    error,
                    "The program {} failed to compile with {}".format(
                        _program_.name, get_global_conf().get("install", "compiler")
                    ),
                )

                # Checks that bitcode was indeed created at the correct place
                if _compiler_.bitcode:
                    conf = get_trigger_conf(_program_.name)
                    self.assertTrue(os.path.exists(conf.get_executable() + ".bc"))
        finally:
            _program_.is_installed.set()
def main(mcp_dir, battlegearCode_dir, runtime_dir):
	
	print '================ Battlegear src Instalation ==================='
	print 'Installing Minceraft Forge'
	install.main(mcp_dir)
	print '================ Clone src ==================='
	src_dir = os.path.join(mcp_dir, 'src')
	src_backup_dir = os.path.join(mcp_dir, 'src_backup')
	
	if os.path.exists(src_backup_dir):
		shutil.rmtree(src_backup_dir)
		
	if os.path.exists(src_dir):
		shutil.copytree(src_dir, src_backup_dir)
	
	print '================ Clone src Done ==================='
	
	print '================ Copy Battlegear Files ==================='
	temp = os.path.abspath('temp.patch')
	cmd = 'patch -u -i'
	cmd = 'patch -p2 -i "%s" ' % temp
    
	if os.name == 'nt':
		applydiff = os.path.abspath(os.path.join(mcp_dir, 'runtime', 'bin', 'applydiff.exe'))
		cmd = '"'+applydiff+'" -u -i'
		cmd = '"%s" -uf -p2 -i "%s"' % (applydiff, temp)
					
	for root, _, filelist in os.walk(battlegearCode_dir, followlinks=True):
		for cur_file in filelist:
				
			bg_file = os.path.join(root, cur_file)
			target_file = os.path.join(root, cur_file).replace(battlegearCode_dir, src_dir)
			
			if cur_file.endswith('.java.patch'):
				
				target_file = target_file[:len(target_file)-6]
				
				target_parent = os.path.abspath(os.path.join(target_file, os.pardir))
				
				next_cmd = cmd + ' "'+target_file+'"'
				
				print 'Patching ' + cur_file[:len(cur_file)-6]
				
				fix_patch(bg_file, temp)
				
				process = subprocess.Popen(cmdsplit(next_cmd), bufsize=-1)
				process.communicate()
			else:
				#not a patch file 
				print 'Copying '+cur_file
				target_parent = os.path.abspath(os.path.join(target_file, os.pardir))
				
				if not os.path.exists(target_parent):
					os.makedirs(target_parent)
				
				shutil.copy(bg_file, target_parent)

	#if os.path.isfile(temp):
	#	os.remove(temp)

	print '================ Copy Battlegear Lang Files ==================='
	langPath = os.path.join(os.path.abspath(os.path.join(battlegearCode_dir, os.pardir)),"battlegear lang files")
	if not os.path.exists(langPath):
		os.makedirs(langPath)
	enUsPath = os.path.join(langPath, "en_US.lang")
	shutil.copy(enUsPath, os.path.join(mcp_dir, "src", "minecraft", "mods", "battlegear2", "client"))
	
	print '================ Copy Battlegear Files Done==================='
	
	print '================ Battlegear src Instalation Done==================='
Пример #10
0
def main():
    # confirm that necessary .quicknote folder exists
    quicknote = path.expanduser('~/.quicknote')
    if not path.isdir(quicknote):
        install.main()

    # send_update_message()
    args = sys.argv[1:]
    files = background_info()

    data_file = files[0]
    current_note = files[1].strip('\n')
    notes = files[2]
    archive_notes = files[3]

    last_slash_index = current_note.rfind('/')
    current_note_name = current_note[last_slash_index + 2:]

    if len(args) == 0:
        info()
        return
    command = args[0]
    if command[0] == '-':
        if len(args) == 1:
            if command == '-l':
                mem.list_memories(current_note, current_note_name)
            elif command == '-cl':
                mem.clear_memories(current_note)
            elif command == '-help' or command == '-h':
                get_help()
            elif command == '-version' or command == '-v':
                get_version()
            elif command == '-ln':
                return_value = note.list_notes(notes)
                if return_value == None:
                    print(
                        'You have no notes at the moment. Start by adding a new note or by importing one from a \'.txt.\' file.'
                    )
            elif command == '-n':
                print(current_note_name)
            elif command == '-cln':
                note.clear_notes(notes, current_note_name, data_file)
            elif command == '-clar':
                note.clear_archive_notes(archive_notes)
            elif command == '-rm':
                note.remove_note(current_note_name, current_note_name,
                                 data_file)
            # this is for archiving the current note
            elif command == '-ar':
                note.archive_note(current_note_name, current_note_name,
                                  data_file)
            elif command == '-lar':
                return_value = note.list_notes(archive_notes)
                if return_value == None:
                    print('You have no archived notes at the moment.')
            else:
                print('qnote error: command \'' + command +
                      '\' not recognized. Please try again.')
                exit(1)
        elif len(args) >= 1:
            if command == '-r':
                mem.remove_memory(current_note, args[1])
            elif command == '-a':
                mem.add_note(args[1:], current_note, data_file)
            elif command == '-ch':
                note_name = note.change_note(args[1:], current_note, data_file)
                if note_name != None:
                    print('Changed current note to \'' + note_name + '\'')
            elif command == '-rn':
                note.rename_note(args[1:], current_note, data_file)
            # this is for removing any note
            elif command == '-rm':
                note.remove_note(args[1:], current_note_name, data_file)
            # this is for archiving any note
            elif command == '-ar':
                note.archive_note(args[1:], current_note_name, data_file)
            elif command == '-unar':
                note.un_archive_note(args[1:])
            elif command == '-in':
                note.import_note(args[1:])
            elif command == '-ex':
                note.export_note(args[1:])
            elif command == '-dp':
                note.duplicate_note(args[1:])
            elif command == '-m':
                mem.move_memory(current_note, args[1], args[2:])
            elif command == '-c':
                mem.copy_memory(current_note, args[1], args[2:])
            else:
                print('qnote error: command \'' + command +
                      '\' not recognized. Please try again.')
                exit(1)
    else:
        mem.add_memory(current_note, args)
Пример #11
0
def main(mcp_dir, battlegearCode_dir, runtime_dir):

    print '================ Battlegear src Instalation ==================='
    print 'Installing Minceraft Forge'
    install.main(mcp_dir)
    print '================ Clone src ==================='
    src_dir = os.path.join(mcp_dir, 'src')
    src_backup_dir = os.path.join(mcp_dir, 'src_backup')

    if os.path.exists(src_backup_dir):
        shutil.rmtree(src_backup_dir)

    if os.path.exists(src_dir):
        shutil.copytree(src_dir, src_backup_dir)

    print '================ Clone src Done ==================='

    print '================ Copy Battlegear Files ==================='
    temp = os.path.abspath('temp.patch')
    cmd = 'patch -u -i'
    cmd = 'patch -p2 -i "%s" ' % temp

    if os.name == 'nt':
        applydiff = os.path.abspath(
            os.path.join(mcp_dir, 'runtime', 'bin', 'applydiff.exe'))
        cmd = '"' + applydiff + '" -u -i'
        cmd = '"%s" -uf -p2 -i "%s"' % (applydiff, temp)

    for root, _, filelist in os.walk(battlegearCode_dir, followlinks=True):
        for cur_file in filelist:

            bg_file = os.path.join(root, cur_file)
            target_file = os.path.join(root, cur_file).replace(
                battlegearCode_dir, src_dir)

            if cur_file.endswith('.java.patch'):

                target_file = target_file[:len(target_file) - 6]

                target_parent = os.path.abspath(
                    os.path.join(target_file, os.pardir))

                next_cmd = cmd + ' "' + target_file + '"'

                print 'Patching ' + cur_file[:len(cur_file) - 6]

                fix_patch(bg_file, temp)

                process = subprocess.Popen(cmdsplit(next_cmd), bufsize=-1)
                process.communicate()
            else:
                #not a patch file
                print 'Copying ' + cur_file
                target_parent = os.path.abspath(
                    os.path.join(target_file, os.pardir))

                if not os.path.exists(target_parent):
                    os.makedirs(target_parent)

                shutil.copy(bg_file, target_parent)

    #if os.path.isfile(temp):
    #	os.remove(temp)

    print '================ Copy Battlegear Lang Files ==================='
    langPath = os.path.join(
        os.path.abspath(os.path.join(battlegearCode_dir, os.pardir)),
        "battlegear lang files")
    if not os.path.exists(langPath):
        os.makedirs(langPath)
    #enUsPath = os.path.join(langPath, "en_US.lang")
    #shutil.copy(enUsPath, os.path.join(mcp_dir, "src", "minecraft", "mods", "battlegear2", "client"))
    for files in os.listdir(langPath):
        if files.endswith(".lang"):
            if not files.startswith("en_US.lang"):
                shutil.copy(
                    os.path.join(langPath, files),
                    os.path.join(mcp_dir, "jars", "lang", "MB-Battlegear 2",
                                 files))

    print '================ Copy Battlegear Files Done==================='

    print '================ Battlegear src Instalation Done==================='
if  __name__ =='__main__':
    if len(sys.argv) < 2:
        print "The name of the mod must be provided"
    else:
        if not os.path.exists('forge.py'):
            print 'Invalid Instalation, installer must be in the forge directory'
        elif os.path.isfile(os.path.join('..', 'runtime', 'commands.py')):
            print 'Invalid Instalation, Minecraft Forge must not be inside the mcp directory'
        else:
            modname = sys.argv[1]
            print 'Executing Source Install Script for '+modname
            if not os.path.isdir(modname+' mod src'):
                os.makedirs(modname+' mod src')
            mcp_dir = os.path.abspath('mcp')
            code_src_dir = os.path.abspath(modname+' mod src')
            lang_dist_dir = os.path.abspath(modname+' lang files')
            
            print '========== Installing Minecraft Forge =========='
            install.main(mcp_dir)
            
            print '========== Cloneing Source Code =========='
            cloneSource(mcp_dir)
            
            print '========== Copying Mod Files =========='
            copyModFiles(code_src_dir, mcp_dir)
            
            print '========== Copying Lang Files =========='
            copyLangFiles(lang_dist_dir, mcp_dir, modname)
            
            print 'Advanced Installation Done for '+modname
Пример #13
0
#import os, fnmatch
#FILES = [os.path.join(dirpath, f)
#    for dirpath, dirnames, files in os.walk('.')
#    for f in fnmatch.filter(files, '*') if '.git' not in dirpath]



if 'bdist_wheel' in argv:
    raise RuntimeError("This setup.py does not support wheels")

#
if 'install' in argv: #-----------------------------------
    print("Running source install...")
    import install
    install.main()
    print('Done!')
    print("Configuring extensions...")
    import configure_nbextensions
    print('Done!')

#

# pip/setuptools install ------------------------------

classifiers = """\
Development Status :: 1 - Planning
Intended Audience :: End Users/Desktop
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Natural Language :: English
Пример #14
0
#!/usr/bin/env python
import install

copy_actions = [
    ('tree'  , 'CnC'    , 'lib-path'),
    ('files' , 'bin'    , 'exe-path'),
    ('dir'   , '%NONE%' , '/opt/util/var/lock')
]

install.main(copy_actions)

Пример #15
0
#import os, fnmatch
#FILES = [os.path.join(dirpath, f)
#    for dirpath, dirnames, files in os.walk('.')
#    for f in fnmatch.filter(files, '*') if '.git' not in dirpath]



if 'bdist_wheel' in argv:
    raise RuntimeError("This setup.py does not support wheels")

#
if 'install' in argv: #-----------------------------------
    print("Running source install...")
    import install
    install.main()
    print('Done!')
    print("Configuring extensions...")
    import configure_nbextensions
    print('Done!')

#

# pip/setuptools install ------------------------------

classifiers = """\
Development Status :: 1 - Planning
Intended Audience :: End Users/Desktop
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Natural Language :: English