def asset_spec_from_abspath(abspath, package):
 if (getattr(package, '__name__', None) == '__main__'):
  return abspath
 pp = (package_path(package) + os.path.sep)
 if abspath.startswith(pp):
  relpath = abspath[len(pp):]
  return ('%s:%s' % (package_name(package), relpath.replace(os.path.sep, '/')))
 return abspath

def asset_spec_from_abspath ( abspath , package ) : if ( getattr ( package , '__name__' , None ) == '__main__' ) : return abspath pp = ( package_path ( package ) + os . path . sep ) if abspath . startswith ( pp ) : relpath = abspath [ len ( pp ) : ] return ( '%s:%s' % ( package_name ( package ) , relpath . replace ( os . path . sep , '/' ) ) ) return abspath
try to convert an absolute path to a resource in a package to a resource specification if possible; otherwise return the absolute path .