2
from distutils.core import setup
3
from distutils.command.sdist import sdist
4
from distutils.command.install_data import install_data
5
from distutils.command.build_scripts import build_scripts
8
from string import find
10
########################################################################
11
# Had to overwrite the prunrefile_list method of sdist to not
12
# remove automatically the RCS/CVS directory from the distribution.
13
########################################################################
15
class modified_sdist(sdist):
16
def prune_file_list(self):
18
Prune off branches that might slip into the file list as created
19
by 'read_template()', but really don't belong there:
20
* the build tree (typically 'build')
21
* the release tree itself (only an issue if we ran 'sdist
22
previously with --keep-temp, or it aborted)
24
build = self.get_finalized_command('build')
25
base_dir = self.distribution.get_fullname()
26
self.filelist.exclude_pattern(None, prefix=build.build_base)
27
self.filelist.exclude_pattern(None, prefix=base_dir)
29
class modified_install_data(install_data):
32
install_cmd = self.get_finalized_command('install')
33
self.install_dir = getattr(install_cmd, 'install_lib')
34
return install_data.run(self)
36
class modified_build_scripts(build_scripts):
38
def copy_scripts(self):
39
#print "scripts:" , self.scripts
40
## copy runVision.py to runVision, inserting "#!python" line at the beginning
41
for script in self.scripts:
42
fnew = open(script, "w")
43
forig = open(script+".py", "r")
44
txt = forig.readlines()
46
fnew.write("#!/usr/bin/env python2.4\n")
49
build_scripts.copy_scripts(self)
51
########################################################################
53
# list of the python packages to be included in this distribution.
54
# sdist doesn't go recursively into subpackages so they need to be
56
# From these packages only the python modules will be taken
59
'Vision.doc.Examples.matplotlib']
61
# list of the python modules not part of a package. Give the path and the
62
# filename without the extension. i.e you want to add the
63
# test.py module which is located in MyPack/Tests/ you give
65
py_modules = ['Vision/bin/runVision',]
67
# list of the files that are not python packages but are included in the
68
# distribution and need to be installed at the proper place by distutils.
69
# The list in MANIFEST.in lists is needed for including those files in
70
# the distribution, data_files in setup.py is needed to install them
74
def getDataFiles(file_list, directory, names):
76
if find(directory, "Tutorial") >= 0:
77
#do not include Tutorial directory in data_files
80
ext = os.path.splitext(name)[1]
81
#print directory, name, ext, len(ext)
82
if ext !=".py" and ext !=".pyc":
83
fullname = os.path.join(directory,name)
84
if not os.path.isdir(fullname):
87
file_list.append((directory, fs))
89
os.path.walk("Vision", getDataFiles, data_files)
92
# description of what is going to be included in the distribution and
94
from version import VERSION
95
setup (name = 'Vision',
97
description = "Vision is a Python-based Visual Programming Environment",
98
author = 'Molecular Graphics Laboratory',
99
author_email = 'sanner@scripps.edu',
100
download_url = 'http://www.scripps.edu/~sanner/software/packager.html',
101
url = 'http://www.scripps.edu/~sanner/software/index.html',
103
py_modules = py_modules,
104
data_files = data_files,
105
scripts = ['Vision/bin/runVision'],
106
cmdclass = {'sdist': modified_sdist,
107
'install_data': modified_install_data,
108
'build_scripts': modified_build_scripts