parameters: (self, scratch_dir, package_name, target_path, url, url_subpath, files_to_remove)
docstring: Install a python package from an URL.
  
          This internal method overwrites the target path if the target
          path already exists.
docstring_summary: Install a python package from an URL.
docstring_tokens: Install a python package from an URL .
function: def _install(self, scratch_dir, package_name, target_path, url, url_subpath, files_to_remove):
          """Install a python package from an URL.
  
          This internal method overwrites the target path if the target
          path already exists.
  
          """
          path = self._download(url=url, scratch_dir=scratch_dir)
          path = self._prepare_package(path, scratch_dir)
  
          if url_subpath is None:
              source_path = path
          else:
              source_path = os.path.join(path, url_subpath)
  
          for filename in files_to_remove:
              path = os.path.join(source_path, filename.replace('/', os.sep))
              if os.path.exists(path):
                  # Pre-emptively change the permissions to #0777 to try and work around win32 permissions issues.
                  os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)
                  os.remove(path)
  
          if os.path.exists(target_path):
              if os.path.isdir(target_path):
                  shutil.rmtree(target_path, ignore_errors=True)
              else:
                  os.remove(target_path)
  
          # shutil.move() command creates intermediate directories if they do not exist.
          shutil.move(source_path, target_path)
  
          # ensure all the new directories are importable.
          intermediate_dirs = os.path.dirname(os.path.relpath(target_path, self._target_dir))
          parent_dirname = self._target_dir
          for dirname in intermediate_dirs.split(os.sep):
              parent_dirname = os.path.join(parent_dirname, dirname)
              self._make_package(parent_dirname)
  
          self._record_url_downloaded(package_name, url)
function_tokens: def _install ( self , scratch_dir , package_name , target_path , url , url_subpath , files_to_remove ) : path = self . _download ( url = url , scratch_dir = scratch_dir ) path = self . _prepare_package ( path , scratch_dir ) if url_subpath is None : source_path = path else : source_path = os . path . join ( path , url_subpath ) for filename in files_to_remove : path = os . path . join ( source_path , filename . replace ( '/' , os . sep ) ) if os . path . exists ( path ) : # Pre-emptively change the permissions to #0777 to try and work around win32 permissions issues. os . chmod ( path , stat . S_IRWXU | stat . S_IRWXG | stat . S_IRWXO ) os . remove ( path ) if os . path . exists ( target_path ) : if os . path . isdir ( target_path ) : shutil . rmtree ( target_path , ignore_errors = True ) else : os . remove ( target_path ) # shutil.move() command creates intermediate directories if they do not exist. shutil . move ( source_path , target_path ) # ensure all the new directories are importable. intermediate_dirs = os . path . dirname ( os . path . relpath ( target_path , self . _target_dir ) ) parent_dirname = self . _target_dir for dirname in intermediate_dirs . split ( os . sep ) : parent_dirname = os . path . join ( parent_dirname , dirname ) self . _make_package ( parent_dirname ) self . _record_url_downloaded ( package_name , url )