#!/usr/bin/env python
"""Installs ttfquery using distutils

Run:
	python setup.py install
to install the package from the source archive.
"""

if __name__ == "__main__":
	import sys,os, string
	from distutils.sysconfig import *
	from distutils.core import setup

	##############
	## Following is from Pete Shinners,
	## apparently it will work around the reported bug on
	## some unix machines where the data files are copied
	## to weird locations if the user's configuration options
	## were entered during the wrong phase of the moon :) .
	from distutils.command.install_data import install_data
	class smart_install_data(install_data):
		def run(self):
			#need to change self.install_dir to the library dir
			install_cmd = self.get_finalized_command('install')
			self.install_dir = getattr(install_cmd, 'install_lib')
			# should create the directory if it doesn't exist!!!
			return install_data.run(self)
	##############

	from sys import hexversion
	if hexversion >= 0x2030000:
		# work around distutils complaints under Python 2.2.x
		extraArguments = {
			'classifiers': [
				"""License :: OSI Approved :: BSD License""",
				"""Programming Language :: Python""",
				"""Topic :: Software Development :: Libraries :: Python Modules""",
				"""Intended Audience :: Developers""",
				"""Operating System :: OS Independent""",
				"""Topic :: Multimedia :: Graphics""",
			],
			'download_url': "https://sourceforge.net/project/showfiles.php?group_id=84080",
			'keywords': 'fonttools,ttf,truetype,outline,font,curve,system fonts',
			'long_description' : """FontTools-based package for querying system fonts

TTFQuery builds on the FontTools package to allow the Python programmer to accomplish a number of tasks:

    * query the system to find installed fonts
    * retrieve metadata about any TTF font file (even those not yet
      installed)
          o abstract family type
          o proper font name
          o glyph outlines
    * build simple metadata registries for run-time font matching

With these functionalities, it is possible to readily
create OpenGL solid-text rendering libraries which
can accept abstract font-family names as font specifiers
and deliver platform-specific TTF files to match those libraries.

TTFQuery doesn't provide rendering services, but a sample
implementation can be found in the OpenGLContext project, from
which TTFQuery was refactored.
""",
			'platforms': ['Any'],
		}
	else:
		extraArguments = {
		}

	### Now the actual set up call
	setup (
		name = "TTFQuery",
		version = "1.0.0",
		description = "FontTools-based package for querying system fonts",
		author = "Mike C. Fletcher",
		author_email = "mcfletch@users.sourceforge.net",
		url = "http://members.rogers.com/mcfletch/",
		license = "BSD-style, see license.txt for details",

		package_dir = {
			'ttfquery':'.',
		},
		packages = [
			'ttfquery', 
		],
		**extraArguments
	)
	
