Exemplo n.º 1
0
 def test_install_commands(self):
     self.installer.copy_application()
     d = pjoin(self.td, 'installed-applications', 'sampleapp')
     self.installer.scheme['commands'] = pjoin(self.td, 'bin')
     self.installer.install_commands()
     testpath.assert_islink(pjoin(self.td, 'bin', 'launch-sampleapp'),
                            pjoin(d, 'run.sh'))
Exemplo n.º 2
0
    def test_symlink_other_python(self):
        if os.name == 'nt':
            raise SkipTest('symlink')
        (self.tmpdir / 'site-packages2').mkdir()
        (self.tmpdir / 'scripts2').mkdir()

        # Called by Installer._auto_user() :
        script1 = ("#!{python}\n"
                   "import sysconfig\n"
                   "print(True)\n"   # site.ENABLE_USER_SITE
                   "print({purelib!r})"  # sysconfig.get_path('purelib')
                  ).format(python=sys.executable,
                           purelib=str(self.tmpdir / 'site-packages2'))

        # Called by Installer._get_dirs() :
        script2 = ("#!{python}\n"
                   "import json, sys\n"
                   "json.dump({{'purelib': {purelib!r}, 'scripts': {scripts!r} }}, "
                   "sys.stdout)"
                  ).format(python=sys.executable,
                           purelib=str(self.tmpdir / 'site-packages2'),
                           scripts=str(self.tmpdir / 'scripts2'))

        with MockCommand('mock_python', content=script1):
            ins = Installer(samples_dir / 'package1' / 'flit.ini', python='mock_python',
                      symlink=True)
        with MockCommand('mock_python', content=script2):
            ins.install()

        assert_islink(self.tmpdir / 'site-packages2' / 'package1',
                      to=samples_dir / 'package1' / 'package1')
        assert_isfile(self.tmpdir / 'scripts2' / 'pkg_script')
        with (self.tmpdir / 'scripts2' / 'pkg_script').open() as f:
            assert f.readline().strip() == "#!mock_python"
Exemplo n.º 3
0
 def test_symlink_package(self):
     if os.name == 'nt':
         raise SkipTest("symlink")
     Installer(samples_dir / 'package1-pkg.ini', symlink=True).install()
     assert_islink(self.tmpdir / 'site-packages' / 'package1',
                   to=str(samples_dir / 'package1'))
     assert_isfile(self.tmpdir / 'scripts' / 'pkg_script')
Exemplo n.º 4
0
 def test_symlink_package(self):
     if os.name == 'nt':
         raise SkipTest("symlink")
     Installer(samples_dir / 'package1' / 'flit.ini', symlink=True).install()
     assert_islink(self.tmpdir / 'site-packages' / 'package1',
                   to=samples_dir / 'package1' / 'package1')
     assert_isfile(self.tmpdir / 'scripts' / 'pkg_script')
     with (self.tmpdir / 'scripts' / 'pkg_script').open() as f:
         assert f.readline().strip() == "#!" + sys.executable
Exemplo n.º 5
0
 def test_symlink_module_pep621(self):
     if os.name == 'nt':
         raise SkipTest("symlink")
     Installer.from_ini_path(core_samples_dir / 'pep621_nodynamic' /
                             'pyproject.toml',
                             symlink=True).install_directly()
     assert_islink(self.tmpdir / 'site-packages' / 'module1.py',
                   to=core_samples_dir / 'pep621_nodynamic' / 'module1.py')
     assert_isdir(self.tmpdir / 'site-packages' / 'module1-0.3.dist-info')
     self._assert_direct_url(core_samples_dir / 'pep621_nodynamic',
                             'module1',
                             '0.3',
                             expected_editable=True)
Exemplo n.º 6
0
 def test_symlink_package(self):
     if os.name == 'nt':
         raise SkipTest("symlink")
     Installer.from_ini_path(samples_dir / 'package1' / 'pyproject.toml',
                             symlink=True).install()
     assert_islink(self.tmpdir / 'site-packages' / 'package1',
                   to=samples_dir / 'package1' / 'package1')
     assert_isfile(self.tmpdir / 'scripts' / 'pkg_script')
     with (self.tmpdir / 'scripts' / 'pkg_script').open() as f:
         assert f.readline().strip() == "#!" + sys.executable
     self._assert_direct_url(samples_dir / 'package1',
                             'package1',
                             '0.1',
                             expected_editable=True)
Exemplo n.º 7
0
    def test_remove_files(self):
        files = [
            pjoin(self.td, 'applications', 'fooview.desktop'),
            pjoin(self.td, 'icons', 'hicolor', '48x48', 'apps', 'tango-calculator.png'),
            pjoin(self.td, 'mime', 'packages', 'example-diff.xml'),
        ]
        script = pjoin(self.td, 'bin', 'launch-sampleapp')

        for file in files:
            testpath.assert_isfile(file)
        testpath.assert_islink(script)

        self.uninstaller.remove_files()

        for path in files + [script]:
            testpath.assert_not_path_exists(path)
Exemplo n.º 8
0
 def test_symlink_package(self):
     Installer(samples_dir / 'package1-pkg.ini', symlink=True).install()
     assert_islink(self.tmpdir / 'site-packages' / 'package1',
                   to=str(samples_dir / 'package1'))
     assert_isfile(self.tmpdir / 'scripts' / 'pkg_script')
Exemplo n.º 9
0
 def test_symlink_package(self):
     Installer(samples_dir / 'package1-pkg.ini', symlink=True).install()
     assert_islink(self.tmpdir / 'site-packages' / 'package1',
                   to=str(samples_dir / 'package1'))
     assert_isfile(self.tmpdir / 'scripts' / 'pkg_script')