コード例 #1
0
ファイル: polyengine.py プロジェクト: alfonmga/polyengine
    def start(self):
        # Script statup steps
        logger.info('PolyEngine v1.0')
        config = Config('config.ini')

        project_name = config.check_setting('PolyEngine', 'Name')
        logger.info('Starting project {}', project_name)

        message = config.check_setting('PolyEngine', 'Message')
        logger.info(message)

        # Source directory of project based on config file
        source_directory = config.check_setting('Compile', 'SourceDirectory')

        # Create the temporary code modification workspace
        workspace = Workspace(source_directory)
        workspace.create_workspace()

        # Process the files
        for f in workspace.source_files:
            if f is not None:
                processor = Processing(f)
                processor.process()

        for f in workspace.header_files:
            if f is not None:
                processor = Processing(f)
                processor.process()

        # Initialize the compiler once information has been loaded
        output_file = config.check_setting('Compile', 'Output')
        commands = config.check_setting('Compile', 'Commands')
        compiler_option = config.check_setting('Compile', 'Compiler')

        if compiler_option == 'gcc' or compiler_option == 'g++':
            compiler = Compile(compiler_option, workspace.source_files,
                               commands, output_file)
            compiler.compile()
        else:
            logger.error('Invalid compiler option selected.')
            exit('Invalid compiler.')

        # Cleanup workspace and exit
        print()
        Cleanup.clean_exit(workspace.work_path)
コード例 #2
0
db = DBConnect(env)

while True:
    space_name = input("Введите Имя Спейса (должно быть уникальным): ")
    if space_name.lower() in db.space_codes_on_server():
        print("Пространство с таким именем уже сущестует. Введите другое имя")
        continue
    break

while True:
    email = input("Введите валидный email (логин должен быть уникальным в рамках всех спейсов): ")
    if new_space_admin.login_exists(email):
        print("Логин занят")
        continue
    break

space_guid = new_space.create_workspace(space_name=space_name, space_code=space_name)
new_space_admin.create_admin_for_new_space(space_guid, email, DEFAULT_ADMIN_PASSWORD)
print(f"\n\nСпейс {space_name} создан. Логин - {email}, Пароль - {DEFAULT_ADMIN_PASSWORD}")

auth = Authorization(env)
headers = auth.create_headers(email, password=DEFAULT_ADMIN_PASSWORD)

new_organization_guid = Organization(env, headers).add_organization(DEFAULT_FIRST_ORGANIZATION_TITLE)
print(f"В спейсе с Guid-кодом - {space_guid} создана организация {DEFAULT_FIRST_ORGANIZATION_TITLE}")
new_space.set_space_owner(new_organization_guid)

new_space_admin.add_admin_to_employees(new_organization_guid, headers)

input("Press any key to exit")