parameters: (path)
docstring: Get the name of the ROS package that contains *path*. This is
      determined by finding the nearest parent ``manifest.xml`` file.
      This routine may not traverse package setups that rely on internal
      symlinks within the package itself.
      
      :param path: filesystem path
      :return: Package name or ``None`` if package cannot be found, ``str``
docstring_summary: Get the name of the ROS package that contains *path*. This is
      determined by finding the nearest parent ``manifest.xml`` file.
      This routine may not traverse package setups that rely on internal
      symlinks within the package itself.
      
      :param path: filesystem path
      :return: Package name or ``None`` if package cannot be found, ``str``
docstring_tokens: Get the name of the ROS package that contains * path * . This is determined by finding the nearest parent manifest . xml file . This routine may not traverse package setups that rely on internal symlinks within the package itself . : param path : filesystem path : return : Package name or None if package cannot be found str
function: def get_package_name(path):
      """
      Get the name of the ROS package that contains *path*. This is
      determined by finding the nearest parent ``manifest.xml`` file.
      This routine may not traverse package setups that rely on internal
      symlinks within the package itself.
      
      :param path: filesystem path
      :return: Package name or ``None`` if package cannot be found, ``str``
      """
      #NOTE: the realpath is going to create issues with symlinks, most
      #likely.
      parent = os.path.dirname(os.path.realpath(path))
      #walk up until we hit ros root or ros/pkg
      while not os.path.exists(os.path.join(path, MANIFEST_FILE)) and not os.path.exists(os.path.join(path, PACKAGE_FILE)) and parent != path:
          path = parent
          parent = os.path.dirname(path)
      # check termination condition
      if os.path.exists(os.path.join(path, MANIFEST_FILE)):
          return os.path.basename(os.path.abspath(path))
      elif os.path.exists(os.path.join(path, PACKAGE_FILE)):
          root = ElementTree(None, os.path.join(path, PACKAGE_FILE))
          return root.findtext('name')
      else:
          return None
function_tokens: def get_package_name ( path ) : #NOTE: the realpath is going to create issues with symlinks, most #likely. parent = os . path . dirname ( os . path . realpath ( path ) ) #walk up until we hit ros root or ros/pkg while not os . path . exists ( os . path . join ( path , MANIFEST_FILE ) ) and not os . path . exists ( os . path . join ( path , PACKAGE_FILE ) ) and parent != path : path = parent parent = os . path . dirname ( path ) # check termination condition if os . path . exists ( os . path . join ( path , MANIFEST_FILE ) ) : return os . path . basename ( os . path . abspath ( path ) ) elif os . path . exists ( os . path . join ( path , PACKAGE_FILE ) ) : root = ElementTree ( None , os . path . join ( path , PACKAGE_FILE ) ) return root . findtext ( 'name' ) else : return None