diff --git a/CITATION b/astroquery/CITATION similarity index 100% rename from CITATION rename to astroquery/CITATION diff --git a/astroquery/__init__.py b/astroquery/__init__.py index d2ec5da825..2d4b649094 100644 --- a/astroquery/__init__.py +++ b/astroquery/__init__.py @@ -12,6 +12,18 @@ from ._astropy_init import * # ---------------------------------------------------------------------------- -# For egg_info test builds to pass, put package imports here. -# if not _ASTROPY_SETUP_: -# from astroquery import * +import os + + +# Set the bibtex entry to the article referenced in CITATION. +def _get_bibtex(): + citation_file = os.path.join(os.path.dirname(__file__), 'CITATION') + + with open(citation_file, 'r') as citation: + refs = citation.read().split('@ARTICLE')[1:] + if len(refs) == 0: return '' + bibtexreference = "@ARTICLE{0}".format(refs[0]) + return bibtexreference + + +__citation__ = __bibtex__ = _get_bibtex()