Exemple #1
0
    def __init__(self):
        if not __xonsh_env__.get('PROJECT_DIRS'):
            print("Warning: Unconfigured $PROJECT_DIRS. Using ~/code")
            home_path = os.path.expanduser('~')
            self.projdirs = [os.path.join(home_path, 'code')]
            __xonsh_env__['PROJECT_DIRS'] = self.projdirs
        else:
            self.projdirs = __xonsh_env__['PROJECT_DIRS']
            if isinstance(self.projdirs, str):
                self.projdirs = [self.projdirs]

        self.vox = voxapi.Vox()
Exemple #2
0
def check_for_new_venv(curdir):
    vox = voxapi.Vox()
    try:
        oldve = vox[...]
    except KeyError:
        oldve = None
    newve = get_venv(vox, curdir)

    if oldve != newve:
        if newve is None:
            vox.deactivate()
        else:
            vox.activate(newve.env)
Exemple #3
0
    def build(self):
        """lazily called during dispatch"""
        self.vox = voxapi.Vox()
        parser = self.create_parser(prog="vox")

        # todo: completer for interpreter
        create = parser.add_command(
            self.new,
            aliases=["create"],
            args=("name", "interpreter", "system_site_packages", "activate"),
        )

        from xonsh.platform import ON_WINDOWS

        group = create.add_mutually_exclusive_group()
        group.add_argument(
            "--symlinks",
            default=not ON_WINDOWS,
            action="store_true",
            dest="symlinks",
            help="Try to use symlinks rather than copies, "
            "when symlinks are not the default for "
            "the platform.",
        )
        group.add_argument(
            "--copies",
            default=ON_WINDOWS,
            action="store_false",
            dest="symlinks",
            help="Try to use copies rather than symlinks, "
            "even when symlinks are the default for "
            "the platform.",
        )
        create.add_argument(
            "--without-pip",
            dest="with_pip",
            default=True,
            action="store_false",
            help="Skips installing or upgrading pip in the "
            "virtual environment (pip is bootstrapped "
            "by default)",
        )

        parser.add_command(self.activate, aliases=["workon", "enter"])
        parser.add_command(self.deactivate, aliases=["exit"])
        parser.add_command(self.list, aliases=["ls"])
        parser.add_command(self.remove, aliases=["rm", "delete", "del"])
        return parser
Exemple #4
0
    def build(self):
        """lazily called during dispatch"""
        self.vox = voxapi.Vox()
        parser = self.create_parser(prog="vox")

        create = parser.add_command(
            self.new,
            aliases=["create"],
        )

        group = create.add_mutually_exclusive_group()
        group.add_argument(
            "--symlinks",
            default=not ON_WINDOWS,
            action="store_true",
            dest="_symlinks",
            help="Try to use symlinks rather than copies, "
            "when symlinks are not the default for "
            "the platform.",
        )
        group.add_argument(
            "--copies",
            default=ON_WINDOWS,
            action="store_false",
            dest="_symlinks",
            help="Try to use copies rather than symlinks, "
            "even when symlinks are the default for "
            "the platform.",
        )

        parser.add_command(self.activate, aliases=["workon", "enter"])
        parser.add_command(self.deactivate, aliases=["exit"])
        parser.add_command(self.list, aliases=["ls"])
        parser.add_command(self.remove, aliases=["rm", "delete", "del"])
        parser.add_command(self.info)
        parser.add_command(self.runin)
        parser.add_command(self.runin_all)
        parser.add_command(self.toggle_ssp)
        parser.add_command(self.wipe)
        parser.add_command(self.project_set)
        parser.add_command(self.project_get)

        return parser
Exemple #5
0
    def build(self):
        """lazily called during dispatch"""
        self.vox = voxapi.Vox()
        parser = self.create_parser(prog="vox")

        parser.add_command(self.new, aliases=["create"])
        parser.add_command(self.activate, aliases=["workon", "enter"])
        parser.add_command(self.deactivate, aliases=["exit"])
        parser.add_command(self.list, aliases=["ls"])
        parser.add_command(self.remove, aliases=["rm", "delete", "del"])
        parser.add_command(self.info)
        parser.add_command(self.runin)
        parser.add_command(self.runin_all)
        parser.add_command(self.toggle_ssp)
        parser.add_command(self.wipe)
        parser.add_command(self.project_set)
        parser.add_command(self.project_get)
        parser.add_command(self.upgrade)

        return parser
Exemple #6
0
 def __init__(self):
     self.vox = voxapi.Vox()
Exemple #7
0
def get_venv_root(env):
    vox = voxapi.Vox()
    return Path(vox[env].env)