/ setup.py
setup.py
 1  #!/usr/bin/python
 2  #   This is a component of aethertool, a command-line interface to aether
 3  #   Copyright 2005-2021 Jeff Epler <jepler@unpythonic.net>
 4  #
 5  #   This program is free software: you can redistribute it and/or modify it
 6  #   under the terms of the GNU General Public License version 3 as published by
 7  #   the Free Software Foundation.
 8  #
 9  #   This program is distributed in the hope that it will be useful, but WITHOUT
10  #   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  #   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  #   more details.
13  #
14  #   You should have received a copy of the GNU General Public License along
15  #   with this program.  If not, see <http://www.gnu.org/licenses/>.
16  
17  
18  from distutils.core import setup
19  
20  import os
21  
22  
23  def require_module(m):
24      try:
25          __import__(m)
26      except ImportError:
27          print("Warning: The required module %r is not available." % m)
28          print("The software will probably not work without it.")
29          return False
30  
31  
32  def require_program(s):
33      for el in os.environ["PATH"].split(os.pathsep):
34          j = os.path.join(el, s)
35          if os.access(j, os.F_OK | os.X_OK):
36              return True
37      print("Warning: The required external program %r is not available." % s)
38      print("The software will probably not work without it.")
39      return False
40  
41  
42  for m in ("Image",):
43      require_module(m)
44  
45  for p in ("pngcrush", "jpegtran"):
46      require_program(p)
47  
48  setup(
49      name="aethertool",
50      version="0.7",
51      author="Jeff Epler",
52      author_email="jepler@unpythonic.net",
53      py_modules=["disorient"],
54      scripts=["aether"],
55      url="http://emergent.unpy.net/software/aethertool/",
56      license="GPL",
57  )
58  # vim:sw=4:sts=4:et