Created
November 29, 2012 13:03
-
-
Save erikzaadi/4168908 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
#NOTE: | |
# This is a terrible hack, but it works ;) | |
# The version and description from the setup.py are fetched and parsed | |
# here.. | |
import pkg_resources # part of setuptools | |
ver = pkg_resources.require("YOUR_PACKAGE_NAME")[0] | |
thetitle = [line for line in ver.get_metadata('PKG-INFO').split("\n") \ | |
if line.startswith("Summary")][0].split(":")[1].strip() | |
version = ver.version | |
except: | |
ver, thetitle = "UNKNOWN", "UNKNOWN" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment