home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 15 / AACD15.ISO / AACD / Programming / Python2 / Python20_source / Misc / distutils / get_metadata.py < prev    next >
Encoding:
Python Source  |  2000-10-25  |  882 b   |  38 lines

  1. #!/usr/bin/env python
  2.  
  3. """get_metadata
  4.  
  5. Pry open a setup script and pick out the juicy bits, ie. the
  6. distribution meta-data.
  7. """
  8.  
  9. # created 2000/08/30, GPW
  10.  
  11. __revision__ = "$Id: get_metadata.py,v 1.1 2000/09/01 01:03:27 gward Exp $"
  12.  
  13. import sys
  14. from distutils.core import run_setup
  15.  
  16. USAGE = "usage: %(script)s setup_script\n"
  17.  
  18.  
  19. def main (script, args):
  20.     if len(args) != 1:
  21.         raise SystemExit, (USAGE % vars()) + "\nWrong number of arguments"
  22.  
  23.     setup_script = args[0]
  24.     dist = run_setup(setup_script, script_args=[], stop_after="init")
  25.     print """\
  26. %s is the setup script for %s; description:
  27. %s
  28.  
  29. contact:  %s <%s>
  30. info url: %s
  31. licence:  %s
  32. """ % (setup_script, dist.get_fullname(), dist.get_description(),
  33.        dist.get_contact(), dist.get_contact_email(),
  34.        dist.get_url(), dist.get_licence())
  35.  
  36. if __name__ == "__main__":
  37.     main(sys.argv[0], sys.argv[1:])
  38.