Пример #1
0
def _common_wheel_editable_install(
    tmpdir_factory: pytest.TempPathFactory, common_wheels: Path, package: str
) -> Path:
    wheel_candidates = list(common_wheels.glob(f"{package}-*.whl"))
    assert len(wheel_candidates) == 1, wheel_candidates
    install_dir = tmpdir_factory.mktemp(package) / "install"
    lib_install_dir = install_dir / "lib"
    bin_install_dir = install_dir / "bin"
    with WheelFile.open(wheel_candidates[0]) as source:
        install(
            source,
            SchemeDictionaryDestination(
                {
                    "purelib": os.fspath(lib_install_dir),
                    "platlib": os.fspath(lib_install_dir),
                    "scripts": os.fspath(bin_install_dir),
                },
                interpreter=sys.executable,
                script_kind="posix",
            ),
            additional_metadata={},
        )
    # The scripts are not necessary for our use cases, and they would be installed with
    # the wrong interpreter, so remove them.
    # TODO consider a refactoring by adding a install_from_wheel(path) method
    # to the virtualenv fixture.
    if bin_install_dir.exists():
        shutil.rmtree(bin_install_dir)
    return lib_install_dir
Пример #2
0
def main(args):
    """Main entry point of the app"""

    destination = SchemeDictionaryDestination(
        dict(
            stdlib=str(args.stdlib_path),
            platstdlib=str(args.platstdlib_path),
            purelib=str(args.purelib_path),
            platlib=str(args.platlib_path),
            include=str(args.include_path),
            platinclude=str(args.platinclude_path),
            scripts=str(args.scripts_path),
            data=str(args.data_path),
        ),
        interpreter=str(args.interpreter),
        script_kind="posix",
    )

    for wheel in args.wheel_path:
        with WheelFile.open(wheel) as source:
            install(
                source=source,
                destination=destination,
                # Additional metadata that is generated
                # by the installation tool.
                additional_metadata={
                    "INSTALLER":
                    'Machinekit-HAL Python wheel'
                    f'installer {__version__}'.encode('utf-8'),
                },
            )

        print(f'Wheel {wheel} installed')

    print("All wheels were installed!")
Пример #3
0
def setup():
    """
    installs postgresql and postgressql-contrib
    """
    packages = 'postgresql postgresql-contrib'
    install(packages)
    set_db_username()
Пример #4
0
def test_install_invalid_element():
    """Install an invalid or unsupported element

    This method raises a FileNotFoundError
    """
    # attempt to install unsupported element "invalid_element"
    with pytest.raises(FileNotFoundError):
        installer.install(element="invalid_element")
Пример #5
0
def test_install_element():
    """Install an element properly

    This method installs and registers element along with its dependencies and verifies
    their registration on the system.
    """
    installer.install(ELEMENT)
    for element in DEPENDENCIES:
        assert installer.is_registered(element)
Пример #6
0
 def install_software(self, family, model, version, download_url, build_type, branch):
     installer.install(
         Software(
             family=family,
             model=model,
             version=version,
             download_url=download_url,
             build_type=build_type,
             branch=branch))
Пример #7
0
def main():
    """Entry point for CLI."""
    ap = argparse.ArgumentParser("python pyinstaller.py")
    ap.add_argument("wheel_file", help="Path to a .whl file to install")

    ap.add_argument("--interpreter",
                    required=True,
                    help="Interpreter path to be used in scripts")
    ap.add_argument(
        "--script-kind",
        required=True,
        choices=["posix", "win-ia32", "win-amd64", "win-arm", "win-arm64"],
        help="Kind of launcher to create for each script",
    )

    dest_args = ap.add_argument_group("Destination directories")
    dest_args.add_argument(
        "--purelib",
        required=True,
        help="Directory for platform-independent Python modules",
    )
    dest_args.add_argument(
        "--platlib",
        help="Directory for platform-dependent Python modules (same as purelib "
        "if not specified)",
    )
    dest_args.add_argument("--headers",
                           required=True,
                           help="Directory for C header files")
    dest_args.add_argument("--scripts",
                           required=True,
                           help="Directory for executable scripts")
    dest_args.add_argument("--data",
                           required=True,
                           help="Directory for external data files")
    args = ap.parse_args()

    destination = SchemeDictionaryDestination(
        {
            "purelib": args.purelib,
            "platlib":
            args.platlib if args.platlib is not None else args.purelib,
            "headers": args.headers,
            "scripts": args.scripts,
            "data": args.data,
        },
        interpreter=args.interpreter,
        script_kind=args.script_kind,
    )

    with WheelFile.open(glob.glob(args.wheel_file)[0]) as source:
        install(
            source=source,
            destination=destination,
            additional_metadata={},
        )
Пример #8
0
def main():
    cwd = os.getcwd()
    f = open(os.path.join(cwd, 'version.txt'), 'r')
    version = float(f.readline().split('=')[1])
    f.close()
    if version == 0:
        install()
        f = open(os.path.join(cwd, 'version.txt'), 'w')
        # TODO: Reach out to server and request updates based on version (Currently Low Priority)
        f.write('version={}'.format('1.0'))
        f.close()
    application = GuiBuilder(cwd)
    application.run()
Пример #9
0
def main():
    # Create a new ArgumentParser
    description = file_get_contents('config/description.txt')
    parser = argparse.ArgumentParser(description=description)

    # Add the command line arguments
    parser.add_argument(
        '-n',
        '--new',
        help='Creates a new CodeIgniter project with the given name')

    # Parse the arguments sent by the user and store them
    args = parser.parse_args()

    # By default, show the help message
    if len(sys.argv[1:]) == 0:
        parser.print_help()
        parser.exit()

    # React accordingly based on which argument they used
    if args.new:
        installer = Installer()

        if os.path.exists(args.new):
            choice = ''

            # Warn the user that the project's folder isn't empty
            # and give them the option of cancelling
            while choice != 'Y' and choice != 'n':
                choice = input(
                    'WARNING: Folder isn\'t empty. Overwrite? (Y/n):')

                if choice != 'Y' and choice != 'n':
                    print('ERROR: Invalid choice. Enter only \'Y\' or \'n\'')

            if choice == 'Y':
                installer.install(args.new)
        else:
            os.makedirs(args.new)
            installer.install(args.new)

        print('Done.')
Пример #10
0
def gibsy_main():
    import sys
    from installer import install
    if len(sys.argv) == 3:
        command = sys.argv[1]
        config_file = sys.argv[2]
        s = Server(config_file)
        if command == "start":
            s.start()
        elif command == "stop":
            s.stop()
        elif command == "restart":
            s.restart()
        elif command == "debug":
            s.run()
        elif command == "update":
            s.update()
    elif len(sys.argv) == 2:
        if sys.argv[1] == "install":
            install()
    else:
        print "gibsy: [update install start stop restart debug] [config_file]"
Пример #11
0
def _main(cli_args: Sequence[str], program: Optional[str] = None) -> None:
    """Process arguments and perform the install."""
    parser = _get_main_parser()
    if program:
        parser.prog = program
    args = parser.parse_args(cli_args)

    bytecode_levels = args.compile_bytecode
    if args.no_compile_bytecode:
        bytecode_levels = []
    elif not bytecode_levels:
        bytecode_levels = [0, 1]

    with installer.sources.WheelFile.open(args.wheel) as source:
        destination = installer.destinations.SchemeDictionaryDestination(
            _get_scheme_dict(source.distribution),
            sys.executable,
            installer.utils.get_launcher_kind(),
            bytecode_optimization_levels=bytecode_levels,
            destdir=args.destdir,
        )
        installer.install(source, destination, {})
Пример #12
0
def configInstaller(file_address: str):
    with open(file_address) as file:
        lines = file.readlines()
    for i in range(2, len(lines)):
        data_string = lines[i].split('\n')[0]
        install(data_string)
Пример #13
0
from installer import install
from Installable import Installable

with open('config.tcc') as file:
    lines = file.readlines()
    for line in lines:
        line = line.strip('\n')
        install(Installable(line.split()[0], line.split()[1], line.split()[2]))
             
Пример #14
0
    def test_rejects_newer_major_wheel_versions(self, mock_destination):
        # Create a fake wheel
        source = FakeWheelSource(
            distribution="fancy",
            version="1.0.0",
            regular_files={
                "fancy/__init__.py":
                b"""\
                    def main():
                        print("I'm a fancy package")
                """,
                "fancy/__main__.py":
                b"""\
                    if __name__ == "__main__":
                        from . import main
                        main()
                """,
            },
            dist_info_files={
                "top_level.txt":
                b"""\
                    fancy
                """,
                "entry_points.txt":
                b"""\
                    [console_scripts]
                    fancy = fancy:main

                    [gui_scripts]
                    fancy-gui = fancy:main
                """,
                "WHEEL":
                b"""\
                    Wheel-Version: 2.0
                    Generator: magic (1.0.0)
                    Root-Is-Purelib: true
                    Tag: py3-none-any
                """,
                "METADATA":
                b"""\
                    Metadata-Version: 2.1
                    Name: fancy
                    Version: 1.0.0
                    Summary: A fancy package
                    Author: Agendaless Consulting
                    Author-email: [email protected]
                    License: MIT
                    Keywords: fancy amazing
                    Platform: UNKNOWN
                    Classifier: Intended Audience :: Developers
                """,
            },
        )

        with pytest.raises(InvalidWheelSource) as ctx:
            install(
                source=source,
                destination=mock_destination,
                additional_metadata={
                    "fun_file.txt": b"this should be in dist-info!",
                },
            )

        assert "Incompatible Wheel-Version" in str(ctx.value)
Пример #15
0
 def onControl( self, control ):
     if control == self.list:
         installer.install( self.skins[self.list.getSelectedPosition()].link )
Пример #16
0
    def test_errors_out_when_given_invalid_scheme_in_data(
            self, mock_destination):
        # Create a fake wheel
        source = FakeWheelSource(
            distribution="fancy",
            version="1.0.0",
            regular_files={
                "fancy/__init__.py":
                b"""\
                    # put me in purelib
                """,
                "fancy-1.0.0.data/purelib/fancy/purelib.py":
                b"""\
                    # put me in purelib
                """,
                "fancy-1.0.0.data/invalid/fancy/invalid.py":
                b"""\
                    # i am invalid
                """,
            },
            dist_info_files={
                "top_level.txt":
                b"""\
                    fancy
                """,
                "entry_points.txt":
                b"""\
                    [console_scripts]
                    fancy = fancy:main

                    [gui_scripts]
                    fancy-gui = fancy:main
                """,
                "WHEEL":
                b"""\
                    Wheel-Version: 1.0
                    Generator: magic (1.0.0)
                    Root-Is-Purelib: true
                    Tag: py3-none-any
                """,
                "METADATA":
                b"""\
                    Metadata-Version: 2.1
                    Name: fancy
                    Version: 1.0.0
                    Summary: A fancy package
                    Author: Agendaless Consulting
                    Author-email: [email protected]
                    License: MIT
                    Keywords: fancy amazing
                    Platform: UNKNOWN
                    Classifier: Intended Audience :: Developers
                """,
            },
        )

        with pytest.raises(InvalidWheelSource) as ctx:
            install(
                source=source,
                destination=mock_destination,
                additional_metadata={},
            )

        assert "fancy-1.0.0.data/invalid/fancy/invalid.py" in str(ctx.value)
Пример #17
0
#!/usr/bin/env python

import installer

files = [
"plClient.exe",
"plClient.pdb",
"UruExplorer.exe",
"UruExplorer.pdb",
"UruLauncher.exe",
"NxCharacter.dll",
"NxCooking.dll",
"PhysXLoader.dll",
"python27.dll",
"PhysX_Setup.exe",
"oalinst.exe",
"Python/Python.pak",
"CREDITS.txt",
"LICENSE.txt"
]

installer.install("C:/urulive/staging/", "data", files)
Пример #18
0
#!/usr/bin/env python

import installer

files = [
"dirtsand.ini",
"static_ages.ini",
"bin/dirtsand"
]

installer.install("/home/branan/plasma/dirtsand/", "srv", files)
Пример #19
0
    def test_calls_destination_correctly(self, mock_destination):
        # Create a fake wheel
        source = FakeWheelSource(
            distribution="fancy",
            version="1.0.0",
            regular_files={
                "fancy/__init__.py":
                b"""\
                    def main():
                        print("I'm a fancy package")
                """,
                "fancy/__main__.py":
                b"""\
                    if __name__ == "__main__":
                        from . import main
                        main()
                """,
            },
            dist_info_files={
                "top_level.txt":
                b"""\
                    fancy
                """,
                "entry_points.txt":
                b"""\
                    [console_scripts]
                    fancy = fancy:main

                    [gui_scripts]
                    fancy-gui = fancy:main
                """,
                "WHEEL":
                b"""\
                    Wheel-Version: 1.0
                    Generator: magic (1.0.0)
                    Root-Is-Purelib: true
                    Tag: py3-none-any
                """,
                "METADATA":
                b"""\
                    Metadata-Version: 2.1
                    Name: fancy
                    Version: 1.0.0
                    Summary: A fancy package
                    Author: Agendaless Consulting
                    Author-email: [email protected]
                    License: MIT
                    Keywords: fancy amazing
                    Platform: UNKNOWN
                    Classifier: Intended Audience :: Developers
                """,
            },
        )

        install(
            source=source,
            destination=mock_destination,
            additional_metadata={
                "fun_file.txt": b"this should be in dist-info!",
            },
        )

        mock_destination.assert_has_calls([
            mock.call.write_script(
                name="fancy",
                module="fancy",
                attr="main",
                section="console",
            ),
            mock.call.write_script(
                name="fancy-gui",
                module="fancy",
                attr="main",
                section="gui",
            ),
            mock.call.write_file(
                scheme="purelib",
                path="fancy/__init__.py",
                stream=mock.ANY,
                is_executable=False,
            ),
            mock.call.write_file(
                scheme="purelib",
                path="fancy/__main__.py",
                stream=mock.ANY,
                is_executable=False,
            ),
            mock.call.write_file(
                scheme="purelib",
                path="fancy-1.0.0.dist-info/METADATA",
                stream=mock.ANY,
                is_executable=False,
            ),
            mock.call.write_file(
                scheme="purelib",
                path="fancy-1.0.0.dist-info/WHEEL",
                stream=mock.ANY,
                is_executable=False,
            ),
            mock.call.write_file(
                scheme="purelib",
                path="fancy-1.0.0.dist-info/entry_points.txt",
                stream=mock.ANY,
                is_executable=False,
            ),
            mock.call.write_file(
                scheme="purelib",
                path="fancy-1.0.0.dist-info/top_level.txt",
                stream=mock.ANY,
                is_executable=False,
            ),
            mock.call.write_file(
                scheme="purelib",
                path="fancy-1.0.0.dist-info/fun_file.txt",
                stream=mock.ANY,
                is_executable=False,
            ),
            mock.call.finalize_installation(
                scheme="purelib",
                record_file_path="fancy-1.0.0.dist-info/RECORD",
                records=[
                    ("scripts", ("fancy", "fancy", "main", "console")),
                    ("scripts", ("fancy-gui", "fancy", "main", "gui")),
                    ("purelib", ("fancy/__init__.py", "purelib", 0)),
                    ("purelib", ("fancy/__main__.py", "purelib", 0)),
                    ("purelib", ("fancy-1.0.0.dist-info/METADATA", "purelib",
                                 0)),
                    ("purelib", ("fancy-1.0.0.dist-info/WHEEL", "purelib", 0)),
                    (
                        "purelib",
                        ("fancy-1.0.0.dist-info/entry_points.txt", "purelib",
                         0),
                    ),
                    (
                        "purelib",
                        ("fancy-1.0.0.dist-info/top_level.txt", "purelib", 0),
                    ),
                    (
                        "purelib",
                        ("fancy-1.0.0.dist-info/fun_file.txt", "purelib", 0),
                    ),
                    (
                        "purelib",
                        RecordEntry("fancy-1.0.0.dist-info/RECORD", None,
                                    None),
                    ),
                ],
            ),
        ])
Пример #20
0
#!/usr/bin/env python

import installer

files = ["dirtsand.ini", "static_ages.ini", "bin/dirtsand"]

installer.install("/home/branan/plasma/dirtsand/", "srv", files)
Пример #21
0
    SETTINGS["AUTO_PART"], SETTINGS["ROOT"], SETTINGS["EFI"], SETTINGS["HOME"],
    SETTINGS["SWAP"], SETTINGS["LANG"], SETTINGS["TIME_ZONE"],
    SETTINGS["USERNAME"], SETTINGS["PASSWORD"], SETTINGS["COMPUTER_NAME"],
    SETTINGS["EXTRAS"], SETTINGS["UPDATES"], SETTINGS["LOGIN"],
    SETTINGS["MODEL"], SETTINGS["LAYOUT"], SETTINGS["VARIENT"])
if INSTALL:
    try:
        # fork() to get proper multi-threading needs
        # PROGRESS = multiprocessing.Process(target=UI.progress.show_progress)
        # PROGRESS = threading.Thread(target=UI.progress.show_progress)
        # PROGRESS.start()
        # otherwise, we are parent and should continue
        process = Popen("/usr/share/system-installer/progress.py")
        pid = process.pid
        SETTINGS["INTERNET"] = check_internet.has_internet()
        installer.install(SETTINGS)
        file_list = listdir("/mnt")
        for each in file_list:
            if each[-3:] in (".sh", ".py", ".xz"):
                try:
                    remove("/mnt/" + each)
                except FileNotFoundError:
                    pass
        common.eprint("    ###    %s CLOSED    ###    " % (sys.argv[0]))
        try:
            copyfile("/tmp/system-installer.log",
                     "/mnt/var/log/system-installer.log")
        except FileNotFoundError:
            common.eprint("    ###    Log Not Found. Testing?    ###    ")
            with open("/tmp/system-installer.log", "w+") as log:
                log.write("""Log was not created during installation.
Пример #22
0
 def installWidget(self):
     file = FileDialog.FileDialog().openFileNameDialog()
     if(file != None):
         aysync.run_await(installer.install(file, self.logger))
         self.target.updateProjectList()
Пример #23
0
#!/usr/bin/env python

import installer

files = [
"ICSharpCode.SharpZipLib.dll",
"PlasmaCore.dll",
"PlasmaNet.dll",
"PlasmaServers.exe",
]

installer.install("C:/urulive/PlasmaDotNet/PlasmaServers/bin/Release", "srv", files)
Пример #24
0
#!/usr/bin/env python

import installer

files = [
    "plClient.exe", "plClient.pdb", "UruExplorer.exe", "UruExplorer.pdb",
    "UruLauncher.exe", "NxCharacter.dll", "NxCooking.dll", "PhysXLoader.dll",
    "python27.dll", "PhysX_Setup.exe", "oalinst.exe", "Python/Python.pak",
    "CREDITS.txt", "LICENSE.txt"
]

installer.install("C:/urulive/staging/", "data", files)
Пример #25
0
def _do_install() -> None:
    """Installs any necessary dependencies."""
    import installer

    installer.install()
Пример #26
0
                               action="store_true",
                               default=False,
                               help="Suppress standard outputs")

    args = parser.parse_args().__dict__

    if args["quiet"]:
        # suppress all console outputs
        installer.LOG = False

    try:
        if args["install"]:
            installer.install(element=args["install"],
                              force=args["force"],
                              generator=args["gen"].lower(),
                              n_jobs=args["jobs"],
                              branch=args["branch"],
                              commit=args["commit"],
                              suppress_dump=args["dump"])

        elif args["uninstall"]:
            installer.uninstall(element=args["uninstall"], force=args["force"])

        elif args["dep"]:
            dep = installer.get_dependencies(args["dep"])
            print("\n".join(dep) if dep else None)

        elif args["list"]:
            all_elements = installer.list_all_elements().keys()
            print("SST Elements".ljust(25), "Registered")
            print("-" * 41)
Пример #27
0
#!/usr/bin/env python

import installer

files = [
    "ICSharpCode.SharpZipLib.dll",
    "PlasmaCore.dll",
    "PlasmaNet.dll",
    "PlasmaServers.exe",
]

installer.install("C:/urulive/PlasmaDotNet/PlasmaServers/bin/Release", "srv",
                  files)
            # Other parts will be automated
            additional_settings = oem.pre_install.show_main()
            for each in additional_settings:
                SETTINGS[each] = additional_settings[each]

except TypeError:
    pass
# Confirm whether settings are correct or not
INSTALL = UI.confirm.show_confirm(SETTINGS, boot_time=boot_time)
if INSTALL:
    try:
        # Run the progress bar in the background
        process = subprocess.Popen("/usr/share/system-installer/progress.py")
        pid = process.pid
        SETTINGS["INTERNET"] = check_internet.has_internet()
        installer.install(SETTINGS, CONFIG["local_repo"])
        shutil.rmtree("/mnt/repo")
        common.eprint("    ###    %s CLOSED    ###    " % (sys.argv[0]))
        try:
            shutil.copyfile("/tmp/system-installer.log",
                     "/mnt/var/log/system-installer.log")
        except FileNotFoundError:
            common.eprint("    ###    Log Not Found. Testing?    ###    ")
            with open("/tmp/system-installer.log", "w+") as log:
                log.write("""Log was not created during installation.
This is a stand-in file.
""")
            shutil.copyfile("/tmp/system-installer.log",
                     "/mnt/var/log/system-installer.log")
        subprocess.Popen(["su", "live", "-c",
                          "/usr/share/system-installer/success.py \'%s\'" % (json.dumps(SETTINGS))])