Exemple #1
0
 def run_command(self, options, args):
     if args:
         # Uninstall pythonidae
         for arg in args:
             pkg = Package(arg)
             pkgname = pkg.name
             pkgpath = os.path.join(PATH_PYTHONS, pkgname)
             venvpath = os.path.join(PATH_VENVS, pkgname)
             if not is_installed(pkgname):
                 logger.error("`%s` is not installed." % pkgname)
                 continue
             if get_using_python_pkgname() == pkgname:
                 off()
             for d in os.listdir(PATH_BIN):
                 # remove symlink
                 path = os.path.join(PATH_BIN, d)
                 if os.path.islink(path):
                     basename = os.path.basename(os.path.realpath(path))
                     tgtpath = os.path.join(pkgpath, "bin", basename)
                     if os.path.isfile(tgtpath) and os.path.samefile(path, tgtpath):
                         unlink(path)
             rm_r(pkgpath)
             rm_r(venvpath)
     else:
         self.parser.print_help()
Exemple #2
0
 def run_command(self, options, args):
     if args:
         # Uninstall pythons
         for arg in args:
             pkg = Package(arg)
             pkgname = pkg.name
             pkgpath = os.path.join(PATH_PYTHONS, pkgname)
             venvpath = os.path.join(PATH_VENVS, pkgname)
             if not is_installed(pkgname):
                 logger.error("`%s` is not installed." % pkgname)
                 continue
             if get_using_python_pkgname() == pkgname:
                 off()
             for d in os.listdir(PATH_BIN):
                 # remove symlink
                 path = os.path.join(PATH_BIN, d)
                 if os.path.islink(path):
                     basename = os.path.basename(os.path.realpath(path))
                     tgtpath = os.path.join(pkgpath, 'bin', basename)
                     if os.path.isfile(tgtpath) and os.path.samefile(
                             path, tgtpath):
                         unlink(path)
             rm_r(pkgpath)
             rm_r(venvpath)
     else:
         self.parser.print_help()
Exemple #3
0
 def _switch_dir(self, pkgdir):
     off()
     symlink(pkgdir, "%s/current" % PATH_PYTHONS)
     for root, dirs, files in os.walk("%s/current/bin/" % PATH_PYTHONS):
         for f in files:
             symlink("%s%s" % (root, f), "%s/%s" % (PATH_BIN, f))
         break
     # I want better code
     if not os.path.isfile("%s/python" % PATH_BIN):
         if os.path.isfile("%s/python3" % PATH_BIN):
             symlink(os.path.realpath("%s/python3" % PATH_BIN), "%s/python" % PATH_BIN)
         elif os.path.isfile("%s/python3.0" % PATH_BIN):
             symlink(os.path.realpath("%s/python3.0" % PATH_BIN), "%s/python" % PATH_BIN)
Exemple #4
0
 def run_command(self, options, args):
     if args:
         pkg = Package(args[0])
         pkgname = pkg.name
         pkgpath = os.path.join(PATH_PYTHONS, pkgname)
         if not os.path.isdir(pkgpath):
             logger.info("`%s` is not installed." % pkgname)
             sys.exit(1)
         if get_current_python_path() == os.path.join(pkgpath,'bin','python'):
             off()
         rm_r(pkgpath)
     else:
         self.parser.print_help()
Exemple #5
0
 def run_command(self, options, args):
     if args:
         pkg = Package(args[0])
         pkgname = pkg.name
         pkgpath = "%s/%s" % (PATH_PYTHONS, pkgname)
         if not os.path.isdir(pkgpath):
             logger.info("`%s` is not installed." % pkgname)
             sys.exit(1)
         if os.path.islink("%s/current" % PATH_PYTHONS):
             curpath = os.path.realpath("%s/current" % PATH_PYTHONS)
             if pkgpath == curpath:
                 off()
         rm_r(pkgpath)
     else:
         self.parser.print_help()
Exemple #6
0
 def run_command(self, options, args):
     if args:
         # Uninstall pythons
         for arg in args:
             pkg = Package(arg)
             pkgname = pkg.name
             pkgpath = os.path.join(PATH_PYTHONS, pkgname)
             if not os.path.isdir(pkgpath):
                 logger.info("`%s` is not installed." % pkgname)
                 continue
             if get_current_python_path() == os.path.join(pkgpath,'bin','python'):
                 off()
             for d in os.listdir(PATH_BIN):
                 # remove symlink
                 path = os.path.join(PATH_BIN, d)
                 if os.path.islink(path):
                     basename = os.path.basename(os.path.realpath(path))
                     tgtpath = os.path.join(pkgpath, 'bin', basename)
                     if os.path.isfile(tgtpath) and os.path.samefile(path, tgtpath):
                         unlink(path)
             rm_r(pkgpath)
     else:
         self.parser.print_help()
Exemple #7
0
 def run_command(self, options, args):
     off()
Exemple #8
0
 def run_command(self, options, args):
     off()