1#! /usr/bin/env python
2
3from __future__ import print_function
4import os, sys
5from distutils.core import setup, Extension
6from distutils.command.build_ext import build_ext
7
8try:
9	# load py2exe distutils extension, if available
10	import py2exe
11except ImportError:
12	pass
13
14try:
15	import xml.parsers.expat
16except ImportError:
17	print("*** Warning: FontTools needs PyXML, see:")
18	print("        http://sourceforge.net/projects/pyxml/")
19
20
21class build_ext_optional(build_ext):
22	"""build_ext command which doesn't abort when it fails."""
23	def build_extension(self, ext):
24		# Skip extensions which cannot be built
25		try:
26			build_ext.build_extension(self, ext)
27		except:
28			self.announce(
29				'*** WARNING: Building of extension "%s" '
30				'failed: %s' %
31				(ext.name, sys.exc_info()[1]))
32
33
34if sys.version_info > (2, 3, 0, 'alpha', 1):
35	# Trove classifiers for PyPI
36	classifiers = {"classifiers": [
37		"Development Status :: 4 - Beta",
38		"Environment :: Console",
39		"Environment :: Other Environment",
40		"Intended Audience :: Developers",
41		"Intended Audience :: End Users/Desktop",
42		"License :: OSI Approved :: BSD License",
43		"Natural Language :: English",
44		"Operating System :: OS Independent",
45		"Programming Language :: Python",
46		"Topic :: Multimedia :: Graphics",
47		"Topic :: Multimedia :: Graphics :: Graphics Conversion",
48	]}
49else:
50	classifiers = {}
51
52long_description = """\
53FontTools/TTX is a library to manipulate font files from Python.
54It supports reading and writing of TrueType/OpenType fonts, reading
55and writing of AFM files, reading (and partially writing) of PS Type 1
56fonts. The package also contains a tool called "TTX" which converts
57TrueType/OpenType fonts to and from an XML-based format.
58"""
59
60setup(
61		name = "fonttools",
62		version = "2.4",
63		description = "Tools to manipulate font files",
64		author = "Just van Rossum",
65		author_email = "just@letterror.com",
66		maintainer = "Just van Rossum",
67		maintainer_email = "just@letterror.com",
68		url = "http://fonttools.sourceforge.net/",
69		license = "OpenSource, BSD-style",
70		platforms = ["Any"],
71		long_description = long_description,
72
73		packages = [
74			"fontTools",
75			"fontTools.encodings",
76			"fontTools.misc",
77			"fontTools.pens",
78			"fontTools.ttLib",
79			"fontTools.ttLib.tables",
80		],
81		package_dir = {'': 'Lib'},
82		extra_path = 'FontTools',
83		scripts = ["Tools/ttx", "Tools/pyftsubset", "Tools/pyftinspect", "Tools/pyftmerge"],
84		cmdclass = {"build_ext": build_ext_optional},
85		data_files = [('share/man/man1', ["Doc/ttx.1"])],
86		**classifiers
87	)
88