#!/bin/bash

echo "This file (bx-pip) has been OBSOLETED"

exit 1

#!/bin/env python
# -*- coding: utf-8 -*-

""" #+begin_org
* ~[Summary]~ :: A =CmndSvc= for
#+end_org """

####+BEGIN: b:py3:cs:file/dblockControls :classification "cs-u"
""" #+begin_org
* [[elisp:(org-cycle)][| /Control Parameters Of This File/ |]] :: dblk ctrls classifications=cs-u
#+BEGIN_SRC emacs-lisp
(setq-local b:dblockControls t) ; (setq-local b:dblockControls nil)
(put 'b:dblockControls 'py3:cs:Classification "cs-u") ; one of cs-mu, cs-u, cs-lib, bpf-lib, pyLibPure
#+END_SRC
#+RESULTS:
: cs-u
#+end_org """
####+END:

####+BEGIN: b:prog:file/proclamations :outLevel 1
""" #+begin_org
* *[[elisp:(org-cycle)][| Proclamations |]]* :: Libre-Halaal Software --- Part Of BISOS ---  Poly-COMEEGA Format.
** This is Libre-Halaal Software. © Neda Communications, Inc. Subject to AGPL.
** It is part of BISOS (ByStar Internet Services OS)
** Best read and edited  with Blee in Poly-COMEEGA (Polymode Colaborative Org-Mode Enhance Emacs Generalized Authorship)
#+end_org """
####+END:

####+BEGIN: b:prog:file/particulars :authors ("./inserts/authors-mb.org")
""" #+begin_org
* *[[elisp:(org-cycle)][| Particulars |]]* :: Authors, version
** This File: /bisos/git/bxRepos/bisos-pip/bx-bases/py3/bin/bx-pip
** Authors: Mohsen BANAN, http://mohsen.banan.1.byname.net/contact
#+end_org """
####+END:

####+BEGIN: b:py3:file/particulars-csInfo :status "inUse"
""" #+begin_org
* *[[elisp:(org-cycle)][| Particulars-csInfo |]]*
#+end_org """
import typing
csInfo: typing.Dict[str, typing.Any] = { 'moduleName': ['bx-pip'], }
csInfo['version'] = '202408034120'
csInfo['status']  = 'inUse'
csInfo['panel'] = 'bx-pip-Panel.org'
csInfo['groupingType'] = 'IcmGroupingType-pkged'
csInfo['cmndParts'] = 'IcmCmndParts[common] IcmCmndParts[param]'
####+END:

""" #+begin_org
* [[elisp:(org-cycle)][| ~Description~ |]] :: [[file:/bisos/git/auth/bxRepos/blee-binders/bisos-core/COMEEGA/_nodeBase_/fullUsagePanel-en.org][BISOS COMEEGA Panel]]
Module description comes here.
** Relevant Panels:
** Status: In use with BISOS
** /[[elisp:(org-cycle)][| Planned Improvements |]]/ :
*** TODO complete fileName in particulars.
#+end_org """

####+BEGIN: b:prog:file/orgTopControls :outLevel 1
""" #+begin_org
* [[elisp:(org-cycle)][| Controls |]] :: [[elisp:(delete-other-windows)][(1)]] | [[elisp:(show-all)][Show-All]]  [[elisp:(org-shifttab)][Overview]]  [[elisp:(progn (org-shifttab) (org-content))][Content]] | [[file:Panel.org][Panel]] | [[elisp:(blee:ppmm:org-mode-toggle)][Nat]] | [[elisp:(bx:org:run-me)][Run]] | [[elisp:(bx:org:run-me-eml)][RunEml]] | [[elisp:(progn (save-buffer) (kill-buffer))][S&Q]]  [[elisp:(save-buffer)][Save]]  [[elisp:(kill-buffer)][Quit]] [[elisp:(org-cycle)][| ]]
** /Version Control/ ::  [[elisp:(call-interactively (quote cvs-update))][cvs-update]]  [[elisp:(vc-update)][vc-update]] | [[elisp:(bx:org:agenda:this-file-otherWin)][Agenda-List]]  [[elisp:(bx:org:todo:this-file-otherWin)][ToDo-List]]

#+end_org """
####+END:

####+BEGIN: b:py3:file/workbench :outLevel 1
""" #+begin_org
* [[elisp:(org-cycle)][| Workbench |]] :: [[elisp:(python-check (format "/bisos/venv/py3/bisos3/bin/python -m pyclbr %s" (bx:buf-fname))))][pyclbr]] || [[elisp:(python-check (format "/bisos/venv/py3/bisos3/bin/python -m pydoc ./%s" (bx:buf-fname))))][pydoc]] || [[elisp:(python-check (format "/bisos/pipx/bin/pyflakes %s" (bx:buf-fname)))][pyflakes]] | [[elisp:(python-check (format "/bisos/pipx/bin/pychecker %s" (bx:buf-fname))))][pychecker (executes)]] | [[elisp:(python-check (format "/bisos/pipx/bin/pycodestyle %s" (bx:buf-fname))))][pycodestyle]] | [[elisp:(python-check (format "/bisos/pipx/bin/flake8 %s" (bx:buf-fname))))][flake8]] | [[elisp:(python-check (format "/bisos/pipx/bin/pylint %s" (bx:buf-fname))))][pylint]]  [[elisp:(org-cycle)][| ]]
#+end_org """
####+END:

####+BEGIN: b:py3:cs:framework/imports :basedOn "classification"
""" #+begin_org
** Imports Based On Classification=cs-u
#+end_org """
from bisos import b
from bisos.b import cs
from bisos.b import b_io
from bisos.common import csParam

import collections
####+END:

import os

""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  CsFrmWrk   [[elisp:(outline-show-subtree+toggle)][||]] ~csuList emacs-list Specifications~  [[elisp:(blee:org:code-block/above-run)][ /Eval Below/ ]] [[elisp:(org-cycle)][| ]]
#+BEGIN_SRC emacs-lisp
(setq  b:py:cs:csuList
  (list
   "bisos.b.cs.ro"
   "blee.icmPlayer.bleep"
   "bisos.common.bxpBaseDir"
 ))
#+END_SRC
#+RESULTS:
| bisos.b.cs.ro | blee.icmPlayer.bleep | bisos.common.bxpBaseDir |
#+end_org """

####+BEGIN: b:py3:cs:framework/csuListProc :pyImports t :csuImports t :csuParams t
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  CsFrmWrk   [[elisp:(outline-show-subtree+toggle)][||]] =Process CSU List= with /3/ in csuList pyImports=t csuImports=t csuParams=t
#+end_org """

from bisos.b.cs import ro
from blee.icmPlayer import bleep
from bisos.common import bxpBaseDir


csuList = [ 'bisos.b.cs.ro', 'blee.icmPlayer.bleep', 'bisos.common.bxpBaseDir', ]

g_importedCmndsModules = cs.csuList_importedModules(csuList)

def g_extraParams():
    csParams = cs.param.CmndParamDict()
    cs.csuList_commonParamsSpecify(csuList, csParams)
    cs.argsparseBasedOnCsParams(csParams)

####+END:

####+BEGIN: bx:cs:python:func :funcName "g_argsExtraSpecify" :comment "FrameWrk: ArgsSpec" :funcType "FrameWrk" :retType "Void" :deco "" :argsList "parser"
"""
*  [[elisp:(org-cycle)][| ]]  [[elisp:(org-show-subtree)][|=]] [[elisp:(show-children)][|V]] [[elisp:(org-tree-to-indirect-buffer)][|>]] [[elisp:(blee:ppmm:org-mode-toggle)][Nat]] [[elisp:(beginning-of-buffer)][Top]] [[elisp:(delete-other-windows)][(1)]] || Func-FrameWrk  :: /g_argsExtraSpecify/ =FrameWrk: ArgsSpec= retType=Void argsList=(parser)  [[elisp:(org-cycle)][| ]]
"""
def g_argsExtraSpecify(
    parser,
):
####+END:
    """Module Specific Command Line Parameters.
    g_argsExtraSpecify is passed to G_main and is executed before argsSetup (can not be decorated)
    """
    G = cs.globalContext.get()
    csParams = cs.CmndParamDict()

    csParams.parDictAdd(
        parName='moduleVersion',
        parDescription="Module Version",
        parDataType=None,
        parDefault=None,
        parChoices=list(),
        parScope=cs.CmndParamScope.TargetParam,
        argparseShortOpt=None,
        argparseLongOpt='--version',
    )

    csParams.parDictAdd(
        parName='pkgSrc',
        parDescription="Package Source",
        parDataType=None,
        parDefault=None,
        parChoices=list(),
        parScope=cs.CmndParamScope.TargetParam,
        argparseShortOpt=None,
        argparseLongOpt='--pkgSrc',
    )

    csParams.parDictAdd(
        parName='venv',
        parDescription="Python Virtual Env. -- A relative or absolute path to an exisiting venv",
        parDataType=None,
        parDefault=None,
        parChoices=list(),
        parScope=cs.CmndParamScope.TargetParam,
        argparseShortOpt=None,
        argparseLongOpt='--venv',
    )

    # bleep.commonParamsSpecify(csParams)

    # bxpBaseDir.commonParamsSpecify(csParams)

    cs.argsparseBasedOnCsParams(parser, csParams)

    # So that it can be processed later as well.
    G.icmParamDictSet(csParams)

    return



####+BEGIN: b:py3:cs:main/exposedSymbols :classes ()
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  CsFrmWrk   [[elisp:(outline-show-subtree+toggle)][||]] ~Exposed Symbols List Specification~ with /0/ in Classes List
#+end_org """
####+END:

####+BEGIN: blee:bxPanel:foldingSection :outLevel 0 :sep nil :title "CmndSvcs" :anchor ""  :extraInfo "Command Services Section"
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*     [[elisp:(outline-show-subtree+toggle)][| _CmndSvcs_: |]]  Command Services Section  [[elisp:(org-shifttab)][<)]] E|
#+end_org """
####+END:

####+BEGIN: b:py3:cs:cmnd/classHead :cmndName "examples" :extent "verify" :ro "noCli" :comment "FrameWrk: CS-Main-Examples" :parsMand "" :parsOpt "" :argsMin "0" :argsMax "0" :asFunc "" :interactiveP ""
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  CmndSvc-   [[elisp:(outline-show-subtree+toggle)][||]] <<examples>>  *FrameWrk: CS-Main-Examples*  =verify= argsMin=0 argsMax=0 ro=noCli   [[elisp:(org-cycle)][| ]]
#+end_org """
class examples(cs.Cmnd):
    cmndParamsMandatory = [ ]
    cmndParamsOptional = [ ]
    cmndArgsLen = {'Min': 0, 'Max': 0,}
    rtInvConstraints = cs.rtInvoker.RtInvoker.new_noRo() # NO RO From CLI

    @cs.track(fnLoc=True, fnEntry=True, fnExit=True)
    def cmnd(self,
             rtInv: cs.RtInvoker,
             cmndOutcome: b.op.Outcome,
             argsList: typing.Optional[list[str]]=None,  # CsArgs
    ) -> b.op.Outcome:
        """FrameWrk: CS-Main-Examples"""
        failed = b_io.eh.badOutcome
        callParamsDict = {}
        if self.invocationValidate(rtInv, cmndOutcome, callParamsDict, argsList).isProblematic():
            return failed(cmndOutcome)
        cmndArgsSpecDict = self.cmndArgsSpec()
####+END:
        self.cmndDocStr(f""" #+begin_org ***** [[elisp:(org-cycle)][| *CmndDesc:* | ]]  Conventional top level example.
        #+end_org """)

        def cpsInit(): return collections.OrderedDict()
        def menuItem(verbosity): cs.examples.cmndInsert(cmndName, cps, cmndArgs, verbosity=verbosity) # 'little' or 'none'
        def execLineEx(cmndStr): cs.examples.execInsert(execLine=cmndStr)

        #logControler = b_io.log.Control()
        #logControler.loggerSetLevel(20)

        cs.examples.myName(cs.G.icmMyName(), cs.G.icmMyFullName())

        cs.examples.commonBrief()

        bleep.examples_icmBasic()

        selectedPipPkg = "unisos.marme"

        cs.examples.menuChapter('=Misc=  *Facilities*')

        cmndName = 'someCmnd' ; cmndArgs = '' ;
        cps=cpsInit() ; menuItem(verbosity='little')

        cs.examples.menuChapter('=ExecLine Example=  *Example Of GPG Commands*')

        execLineEx(f"""echo sudo apt -y install gnupg""")

        b.ignore(ro.__doc__,)  # We are not using these modules, but they are auto imported.

####+BEGIN: bx:cs:python:cmnd:subSection :title "withVenv Run PIP Commands"
        """
**  [[elisp:(beginning-of-buffer)][Top]] ================ [[elisp:(blee:ppmm:org-mode-toggle)][Nat]] [[elisp:(delete-other-windows)][(1)]]          *withVenv Run PIP Commands*  [[elisp:(org-cycle)][| ]]  [[elisp:(org-show-subtree)][|=]]
"""
####+END:

        cs.examples.menuChapter('*Bootstarping Pip*')

        execLineEx("""apt-get install python-pip  # Installs pip 8.1.1 but has problems upgrading""")
        execLineEx("""curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py""")
        execLineEx("""python get-pip.py""")

        cs.examples.menuChapter('*Create Virtual Environments*')

        cs.examples.menuSection('*Create Ephemera Virtenv*')

        execLineEx("""echo virtualenv -p python2 /tmp/py2v1  # Create Ephemera""")
        execLineEx("""echo virtualenv -p python3 /tmp/py3v1  # Create Ephemera""")

        cs.examples.menuSection('*Create BISOS Virtenv*')

        execLineEx("""echo virtualenv -p python2 /bisos/venv/py2-bisos-3  # Create BISOS -- or /bisos/venv/dev-py2-bisos-3 """)
        execLineEx("""echo virtualenv -p python3 /bisos/venv/py3-bisos-3  # Create BISOS -- or /bisos/venv/dev-py3-bisos-3 """)

        cs.examples.menuChapter('*Run pip Commands*')

        cs.examples.menuSection('*pip Information Commands*')

        cmndName = "withVenv"

        cmndArgs = "pip list";

        cps = cpsInit() ; cps['venv'] = "/bisos/venv/py2-bisos-3" ; menuItem('none')
        cps = cpsInit() ; cps['venv'] = "/bisos/venv/py3-bisos-3" ; menuItem('none')
        cps = cpsInit() ; cps['venv'] = "" ; menuItem('none')

        cmndArgs = "pip show --verbose {}".format(selectedPipPkg)
        cps = cpsInit() ; cps['venv'] = "/bisos/venv/py2-bisos-3" ; menuItem('none')

        cs.examples.menuSection('*pip install Commands*')

        cmndArgs = "pip install  /de/bx/nne/dev-py/pypi/pkgs/unisos/marme/rel/dist/unisos.marme-0.8.tar.gz" ;
        cps = cpsInit() ; cps['venv'] = "/bisos/venv/py2-bisos-3" ; menuItem('none')
        cps = cpsInit() ; cps['venv'] = "/bisos/venv/py3-bisos-3" ; menuItem('none')

        cmndArgs = "pip install {}".format(selectedPipPkg) ;
        cps = cpsInit() ; cps['venv'] = "/bisos/venv/py2-bisos-3" ; menuItem('none')
        cps = cpsInit() ; cps['venv'] = "/bisos/venv/py3-bisos-3" ; menuItem('none')

        cmndArgs = "pip install --no-cache-dir --upgrade {}".format(selectedPipPkg) ;
        cps = cpsInit() ; cps['venv'] = "/bisos/venv/py2-bisos-3" ; menuItem('none')
        cps = cpsInit() ; cps['venv'] = "/bisos/venv/py3-bisos-3" ; menuItem('none')

####+BEGIN: bx:cs:python:cmnd:subSection :title "SLICE pip install pkgsLists"
        """
**  [[elisp:(beginning-of-buffer)][Top]] ================ [[elisp:(blee:ppmm:org-mode-toggle)][Nat]] [[elisp:(delete-other-windows)][(1)]]          *SLICE pip install pkgsLists*  [[elisp:(org-cycle)][| ]]  [[elisp:(org-show-subtree)][|=]]
"""
####+END:

        cs.examples.menuChapter('*SLICE -- pip install pkgsLists*')

        cmndName = "slice"

        cmndArgs = "update BisosFoundation BisosBase"
        cps = cpsInit() ; cps['venv'] = "/bisos/venv/py2-bisos-3" ; menuItem('none')
        cps = cpsInit() ; cps['venv'] = "/bisos/venv/py3-bisos-3" ; menuItem('none')

####+BEGIN: bx:cs:python:cmnd:subSection :title "Direct PIP Commands"
        """
**  [[elisp:(beginning-of-buffer)][Top]] ================ [[elisp:(blee:ppmm:org-mode-toggle)][Nat]] [[elisp:(delete-other-windows)][(1)]]          *Direct PIP Commands*  [[elisp:(org-cycle)][| ]]  [[elisp:(org-show-subtree)][|=]]
"""
####+END:

        cs.examples.menuChapter('*Activate / Deactivate Pip Environments*')

        execLineEx("""source /bisos/venv/py2-bisos-3/bin/activate""".format())
        execLineEx("""source /bisos/venv/py3-bisos-3/bin/activate""".format())
        execLineEx("""deactivate""".format())

        cs.examples.menuChapter('*Direct pip Commands*')

        execLineEx("""pip show {pipPkgName}""".format(pipPkgName=selectedPipPkg))
        execLineEx("""pip show --verbose {pipPkgName}""".format(pipPkgName=selectedPipPkg))
        execLineEx("""pip show -f {pipPkgName}""".format(pipPkgName=selectedPipPkg))
        execLineEx("""pip uninstall {pipPkgName}""".format(pipPkgName=selectedPipPkg))
        execLineEx("""pip download {pipPkgName}""".format(pipPkgName=selectedPipPkg))
        execLineEx("""pip list --outdated --format columns     # Lists pkgs that are intersection of local and pypi""")

####+BEGIN: bx:cs:python:cmnd:subSection :title "Imported: bxPlatformBaseDirs"
        """
**  [[elisp:(beginning-of-buffer)][Top]] ================ [[elisp:(blee:ppmm:org-mode-toggle)][Nat]] [[elisp:(delete-other-windows)][(1)]]          *Imported: bxPlatformBaseDirs*  [[elisp:(org-cycle)][| ]]  [[elisp:(org-show-subtree)][|=]]
"""
####+END:


        bxpBaseDir.examples_bxPlatformBaseDirs()


        return(cmndOutcome)

####+BEGIN: bx:icm:py3:section :title "CS-Commands"
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  /Section/    [[elisp:(outline-show-subtree+toggle)][||]] *CS-Commands*  [[elisp:(org-cycle)][| ]]
#+end_org """
####+END:


####+BEGIN: bx:cs:python:func :funcName "withVenvGetInfo" :funcType "anyOrNone" :retType "bool" :deco "" :argsList "venv"
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  F-anyOrNone [[elisp:(outline-show-subtree+toggle)][||]] /withVenvGetInfo/ retType=bool argsList=(venv)  [[elisp:(org-cycle)][| ]]
#+end_org """
def withVenvGetInfo(
    venv,
):
####+END:
    """
** Given venv, determine and return pythonVersion and bisosVersion.
"""
    pythonFile = os.path.join(venv, "bin", "python")
    pyLink = os.readlink(pythonFile)
    pyVersion = pyLink.replace("python", "")
    bisosVersion = "3"
    return pyVersion, bisosVersion


####+BEGIN: b:py3:cs:cmnd/classHead :cmndName "withVenv" :parsMand "venv" :parsOpt "baseDir pkgSrc" :argsMin 2 :argsMax 1000 :pyInv ""
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  CmndSvc-   [[elisp:(outline-show-subtree+toggle)][||]] <<withVenv>>  =verify= parsMand=venv parsOpt=baseDir pkgSrc argsMin=2 argsMax=1000 ro=cli   [[elisp:(org-cycle)][| ]]
#+end_org """
class withVenv(cs.Cmnd):
    cmndParamsMandatory = [ 'venv', ]
    cmndParamsOptional = [ 'baseDir', 'pkgSrc', ]
    cmndArgsLen = {'Min': 2, 'Max': 1000,}

    @cs.track(fnLoc=True, fnEntry=True, fnExit=True)
    def cmnd(self,
             rtInv: cs.RtInvoker,
             cmndOutcome: b.op.Outcome,
             venv: typing.Optional[str]=None,  # Cs Mandatory Param
             baseDir: typing.Optional[str]=None,  # Cs Optional Param
             pkgSrc: typing.Optional[str]=None,  # Cs Optional Param
             argsList: typing.Optional[list[str]]=None,  # CsArgs
    ) -> b.op.Outcome:

        failed = b_io.eh.badOutcome
        callParamsDict = {'venv': venv, 'baseDir': baseDir, 'pkgSrc': pkgSrc, }
        if self.invocationValidate(rtInv, cmndOutcome, callParamsDict, argsList).isProblematic():
            return failed(cmndOutcome)
        cmndArgsSpecDict = self.cmndArgsSpec()
        venv = csParam.mappedValue('venv', venv)
        baseDir = csParam.mappedValue('baseDir', baseDir)
        pkgSrc = csParam.mappedValue('pkgSrc', pkgSrc)
####+END:

        effectiveArgsList = argsList
        if effectiveArgsList[0] != "pip":
            b_io.eh.problem_usageError("")
            return

        if effectiveArgsList[1] == "install":
            pass
            #
            # Changed the usage model -- User is expected to have sourced virtenv activate
            #
            # effectiveArgsList.insert(2, """--install-option="--install-data={}" """.format(
            #     bxpBaseDir.bpbDist_baseObtain_input(baseDir,)))
            # effectiveArgsList.insert(2, """--install-option="--install-scripts={}" """.format(
            #     bxpBaseDir.bpbDist_baseObtain_bin(baseDir,)))

        pipCmndLine = " ".join(argsList)

        def venvPathGet():
            if os.path.isabs(venv):
                return venv
            return os.path.join(baseDir, venv)

        if venv:
            venvPath = venvPathGet()
            activateFile = os.path.join(venvPath, "bin/activate")
            sourceCmnd = """source {activateFile}; """.format(activateFile=activateFile)
        else:
            sourceCmnd = ""

        outcome = icm.subProc_bash(
            """{sourceCmnd} {pipCmndLine}"""
            .format(sourceCmnd=sourceCmnd, pipCmndLine=pipCmndLine)
        ).out()
        if outcome.isProblematic(): return b_io.eh.badOutcome(outcome)

        #resultStr = outcome.stdout.strip()
        #b_io.ann.write(resultStr)

    def cmndDocStr(self): return """
** invoke specified pip command, in the specified virtenv [[elisp:(org-cycle)][| ]]
"""



####+BEGIN: b:py3:cs:cmnd/classHead :cmndName "slice" :parsMand "venv" :parsOpt "baseDir pkgSrc" :argsMin 2 :argsMax 1000 :pyInv ""
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  CmndSvc-   [[elisp:(outline-show-subtree+toggle)][||]] <<slice>>  =verify= parsMand=venv parsOpt=baseDir pkgSrc argsMin=2 argsMax=1000 ro=cli   [[elisp:(org-cycle)][| ]]
#+end_org """
class slice(cs.Cmnd):
    cmndParamsMandatory = [ 'venv', ]
    cmndParamsOptional = [ 'baseDir', 'pkgSrc', ]
    cmndArgsLen = {'Min': 2, 'Max': 1000,}

    @cs.track(fnLoc=True, fnEntry=True, fnExit=True)
    def cmnd(self,
             rtInv: cs.RtInvoker,
             cmndOutcome: b.op.Outcome,
             venv: typing.Optional[str]=None,  # Cs Mandatory Param
             baseDir: typing.Optional[str]=None,  # Cs Optional Param
             pkgSrc: typing.Optional[str]=None,  # Cs Optional Param
             argsList: typing.Optional[list[str]]=None,  # CsArgs
    ) -> b.op.Outcome:

        failed = b_io.eh.badOutcome
        callParamsDict = {'venv': venv, 'baseDir': baseDir, 'pkgSrc': pkgSrc, }
        if self.invocationValidate(rtInv, cmndOutcome, callParamsDict, argsList).isProblematic():
            return failed(cmndOutcome)
        cmndArgsSpecDict = self.cmndArgsSpec()
        venv = csParam.mappedValue('venv', venv)
        baseDir = csParam.mappedValue('baseDir', baseDir)
        pkgSrc = csParam.mappedValue('pkgSrc', pkgSrc)
####+END:

        effectiveArgsList = argsList
        actionStr = effectiveArgsList[0]

        def venvPathGet():
            if os.path.isabs(venv):
                return venv
            return os.path.join(baseDir, venv)

        venvPath = venvPathGet()

        pyVersion , bisosVersion = withVenvGetInfo(venv)

        slicesList = effectiveArgsList[1:]
        for eachSlice in slicesList:

            pipPkgsList = eval(
                """bxPipPkgs.PipPkgsList_{eachSlice}(virtualenvBaseDir="{venvPath}", pyVersion={pyVersion}, bisosVersion={bisosVersion})""".
                format(eachSlice=eachSlice, venvPath=venvPath, pyVersion=pyVersion, bisosVersion=bisosVersion))

            pipPkgsList.execActionStr(actionStr)

        return

    def cmndDocStr(self): return """
** Common Usage: {myName} -p baseDir=/bisos -p venv=/bisos/venv/py2-bisos-3 -i {thisCmnd} update sliceName1 sliceName2 [[elisp:(org-cycle)][| ]]
   -p pkgSrc= can specifiy othern than pypi

""".format(myName=G.myName, thisCmnd=self.__class__.__name__)




####+BEGIN: blee:bxPanel:foldingSection :outLevel 0 :sep nil :title "Main" :anchor ""  :extraInfo "Framework Dblock"
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*     [[elisp:(outline-show-subtree+toggle)][| _Main_: |]]  Framework Dblock  [[elisp:(org-shifttab)][<)]] E|
#+end_org """
####+END:

####+BEGIN: b:py3:cs:framework/main :csInfo "csInfo" :noCmndEntry "examples" :extraParamsHook "g_extraParams" :importedCmndsModules "g_importedCmndsModules"
""" #+begin_org
*  _[[elisp:(blee:menu-sel:outline:popupMenu)][±]]_ _[[elisp:(blee:menu-sel:navigation:popupMenu)][Ξ]]_ [[elisp:(outline-show-branches+toggle)][|=]] [[elisp:(bx:orgm:indirectBufOther)][|>]] *[[elisp:(blee:ppmm:org-mode-toggle)][|N]]*  CsFrmWrk   [[elisp:(outline-show-subtree+toggle)][||]] =g_csMain= (csInfo, _examples_, g_extraParams, g_importedCmndsModules)
#+end_org """

if __name__ == '__main__':
    cs.main.g_csMain(
        csInfo=csInfo,
        noCmndEntry=examples,  # specify a Cmnd name
        extraParamsHook=g_extraParams,
        importedCmndsModules=g_importedCmndsModules,
    )

####+END:

####+BEGIN: b:py3:cs:framework/endOfFile :basedOn "classification"
""" #+begin_org
* [[elisp:(org-cycle)][| *End-Of-Editable-Text* |]] :: emacs and org variables and control parameters
#+end_org """

#+STARTUP: showall

### local variables:
### no-byte-compile: t
### end:
####+END:
