def _is_astropy_setup():
 main_mod = sys.modules.get('__main__')
 if (not main_mod):
  return False
 return (getattr(main_mod, '__file__', False) and (os.path.basename(main_mod.__file__).rstrip('co') == 'setup.py') and _is_astropy_source(main_mod.__file__))

def _is_astropy_setup ( ) : main_mod = sys . modules . get ( '__main__' ) if ( not main_mod ) : return False return ( getattr ( main_mod , '__file__' , False ) and ( os . path . basename ( main_mod . __file__ ) . rstrip ( 'co' ) == 'setup.py' ) and _is_astropy_source ( main_mod . __file__ ) )
returns whether we are currently being imported in the context of running astropys setup .