コード例 #1
0
ファイル: install.py プロジェクト: sharmaeklavya2/sage
    def _install_spec(self):
        """
        Install the Sage IPython kernel
        
        It is safe to call this method multiple times, only one Sage
        kernel spec is ever installed for any given Sage
        version. However, it resets the IPython kernel spec directory
        so additional resources symlinked there are lost. See
        :meth:`symlink_resources`.

        EXAMPLES::

            sage: from sage.repl.ipython_kernel.install import SageKernelSpec
            sage: spec = SageKernelSpec()
            sage: spec._install_spec()    # not tested
        """
        import json

        temp = tmp_dir()
        kernel_spec = os.path.join(temp, "kernel.json")
        with open(kernel_spec, "w") as f:
            json.dump(self.kernel_spec(), f)
        identifier = self.identifier()
        install_kernel_spec(temp, identifier, user=True, replace=True)
        self._spec = get_kernel_spec(identifier)
コード例 #2
0
ファイル: install.py プロジェクト: jrfiedler/stata-kernel
def install_my_kernel_spec(user=True):
    with TemporaryDirectory() as td:
        os.chmod(td, 0o755) # Starts off as 700, not user readable
        with open(os.path.join(td, 'kernel.json'), 'w') as f:
            json.dump(kernel_json, f, sort_keys=True)

        print('Installing IPython kernel spec')
        install_kernel_spec(td, 'stata', user=user, replace=True)
コード例 #3
0
def install_my_kernel_spec(user=True):
    with TemporaryDirectory() as td:
        os.chmod(td, 0o755)  # Starts off as 700, not user readable
        with open(os.path.join(td, 'kernel.json'), 'w') as f:
            json.dump(kernel_json, f, sort_keys=True)

        print('Installing IPython kernel spec')
        install_kernel_spec(td, 'stata', user=user, replace=True)
コード例 #4
0
ファイル: install.py プロジェクト: Calysto/calysto_lc3
def install_my_kernel_spec(user=True):
    with TemporaryDirectory() as td:
        os.chmod(td, 0o755) # Starts off as 700, not user readable
        with open(os.path.join(td, 'kernel.json'), 'w') as f:
            json.dump(kernel_json, f, sort_keys=True)
        # TODO: Copy resources once they're specified

        print('Installing IPython kernel spec')
        install_kernel_spec(td, 'calysto_lc3', user=user, replace=True)
コード例 #5
0
ファイル: setup.py プロジェクト: schlichtanders/metakernel
    def run(self):
        install.run(self)
        from IPython.kernel.kernelspec import install_kernel_spec
        from IPython.utils.tempdir import TemporaryDirectory

        with TemporaryDirectory() as td:
            os.chmod(td, 0o755)  # Starts off as 700, not user readable
            with open(os.path.join(td, "kernel.json"), "w") as f:
                json.dump(kernel_json, f, sort_keys=True)
            log.info("Installing kernel spec")
            try:
                install_kernel_spec(td, "metakernel_bash", user=self.user, replace=True)
            except:
                install_kernel_spec(td, "metakernel_bash", user=not self.user, replace=True)
コード例 #6
0
ファイル: setup.py プロジェクト: imclab/bash_kernel
    def run(self):
        # Regular installation
        install.run(self)

        # Now write the kernelspec
        from IPython.kernel.kernelspec import install_kernel_spec
        from IPython.utils.tempdir import TemporaryDirectory
        with TemporaryDirectory() as td:
            os.chmod(td, 0o755) # Starts off as 700, not user readable
            with open(os.path.join(td, 'kernel.json'), 'w') as f:
                json.dump(kernel_json, f, sort_keys=True)
            # TODO: Copy resources once they're specified

            log.info('Installing IPython kernel spec')
            install_kernel_spec(td, 'bash', user=self.user, replace=True)
コード例 #7
0
ファイル: setup.py プロジェクト: ppope/calysto_scheme
 def run(self):
     install.run(self)
     from IPython.kernel.kernelspec import install_kernel_spec
     from IPython.utils.tempdir import TemporaryDirectory
     from metakernel.utils.kernel import install_kernel_resources
     with TemporaryDirectory() as td:
         os.chmod(td, 0o755) # Starts off as 700, not user readable
         with open(os.path.join(td, 'kernel.json'), 'w') as f:
             json.dump(kernel_json, f, sort_keys=True)
         install_kernel_resources(td, resource="calysto_scheme")
         log.info('Installing kernel spec')
         try:
             install_kernel_spec(td, 'calysto_scheme', replace=True)
         except:
             install_kernel_spec(td, 'calysto_scheme', user=self.user, replace=True)
コード例 #8
0
    def run(self):
        # Regular installation
        install.run(self)

        # Now write the kernelspec
        from IPython.kernel.kernelspec import install_kernel_spec
        from IPython.utils.tempdir import TemporaryDirectory
        with TemporaryDirectory() as td:
            os.chmod(td, 0o755)  # Starts off as 700, not user readable
            with open(os.path.join(td, 'kernel.json'), 'w') as f:
                json.dump(kernel_json, f, sort_keys=True)
            # TODO: Copy resources once they're specified

            log.info('Installing IPython kernel spec')
            install_kernel_spec(td, 'postgres', user=self.user, replace=True)
コード例 #9
0
ファイル: setup.py プロジェクト: LukasDrude/matlab_kernel
def install_spec():
    user = '******' in sys.argv
    from IPython.kernel.kernelspec import install_kernel_spec
    from IPython.utils.tempdir import TemporaryDirectory
    with TemporaryDirectory() as td:
        os.chmod(td, 0o755)  # Starts off as 700, not user readable
        with open(os.path.join(td, 'kernel.json'), 'w') as f:
            json.dump(kernel_json, f, sort_keys=True)
        log.info('Installing kernel spec')
        try:
            install_kernel_spec(td, "matlab_kernel", user=user,
                                replace=True)
        except:
            install_kernel_spec(td, "matlab_kernel", user=not user,
                                replace=True)
コード例 #10
0
def install_spec():
    user = '******' in sys.argv
    from IPython.kernel.kernelspec import install_kernel_spec
    from IPython.utils.tempdir import TemporaryDirectory
    with TemporaryDirectory() as td:
        os.chmod(td, 0o755)  # Starts off as 700, not user readable
        with open(os.path.join(td, 'kernel.json'), 'w') as f:
            json.dump(kernel_json, f, sort_keys=True)
        log.info('Installing kernel spec')
        try:
            install_kernel_spec(td, "matlab_kernel", user=user, replace=True)
        except:
            install_kernel_spec(td,
                                "matlab_kernel",
                                user=not user,
                                replace=True)
コード例 #11
0
 def run(self):
     install.run(self)
     from IPython.kernel.kernelspec import install_kernel_spec
     from IPython.utils.tempdir import TemporaryDirectory
     from metakernel.utils.kernel import install_kernel_resources
     with TemporaryDirectory() as td:
         os.chmod(td, 0o755)  # Starts off as 700, not user readable
         with open(os.path.join(td, 'kernel.json'), 'w') as f:
             json.dump(kernel_json, f, sort_keys=True)
         install_kernel_resources(td, resource="calysto_scheme")
         log.info('Installing kernel spec')
         try:
             install_kernel_spec(td, 'calysto_scheme', replace=True)
         except:
             install_kernel_spec(td,
                                 'calysto_scheme',
                                 user=self.user,
                                 replace=True)
コード例 #12
0
    def _install_spec(self):
        """
        Install the Sage IPython kernel
        
        It is safe to call this method multiple times, only one Sage
        kernel spec is ever installed for any given Sage
        version. However, it resets the IPython kernel spec directory
        so additional resources symlinked there are lost. See
        :meth:`symlink_resources`.

        EXAMPLES::

            sage: from sage.repl.ipython_kernel.install import SageKernelSpec
            sage: spec = SageKernelSpec()
            sage: spec._install_spec()    # not tested
        """
        import json
        temp = tmp_dir()
        kernel_spec = os.path.join(temp, 'kernel.json')
        with open(kernel_spec, 'w') as f:
            json.dump(self.kernel_spec(), f)
        identifier = self.identifier()
        install_kernel_spec(temp, identifier, user=True, replace=True)
        self._spec = get_kernel_spec(identifier)
コード例 #13
0
ファイル: kernel.py プロジェクト: 0xmilk/splash
def install(user=True):
    """ Install IPython kernel specification """
    folder = os.path.join(os.path.dirname(__file__), 'kernels', 'splash')
    install_kernel_spec(folder, kernel_name="splash", user=user, replace=True)
コード例 #14
0
ファイル: setup.py プロジェクト: tmbarchive/iforth
 def run(self):
     install.run(self)
     from IPython.kernel.kernelspec import install_kernel_spec
     install_kernel_spec('kernelspec', 'forth', replace=True)
コード例 #15
0
ファイル: setup.py プロジェクト: fatman2021/iforth
 def run(self):
     install.run(self)
     from IPython.kernel.kernelspec import install_kernel_spec
     install_kernel_spec('kernelspec', 'forth', replace=True)
コード例 #16
0
ファイル: kernel.py プロジェクト: smarthomekit/splash
def install(user=True):
    """ Install IPython kernel specification """
    folder = os.path.join(os.path.dirname(__file__), 'kernels', 'splash')
    install_kernel_spec(folder, kernel_name="splash", user=user, replace=True)