~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: mattgiuca
  • Date: 2007-12-21 01:55:21 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:117
setup.py: listmake uses mimetypes to select all files with certain mime types,
    instead of just those that end in .py.

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
import getopt
65
65
import string
66
66
import errno
 
67
import mimetypes
67
68
import compileall
68
69
 
69
70
# Try importing existing conf, but if we can't just set up defaults
83
84
# Always defaults
84
85
allowed_uids = "0"
85
86
 
 
87
# Mime types which will automatically be placed in the list by listmake.
 
88
# Note that listmake is not intended to be run by the final user (the system
 
89
# administrator who installs this), so the developers can customize the list
 
90
# as necessary, and include it in the distribution.
 
91
listmake_mimetypes = ['text/x-python', 'text/html',
 
92
    'application/x-javascript', 'application/javascript',
 
93
    'text/css', 'image/png']
 
94
 
86
95
# Main function skeleton from Guido van Rossum
87
96
# http://www.artima.com/weblogs/viewpost.jsp?thread=4829
88
97
 
212
221
    # (since listmake is typically run before conf)
213
222
    if "www/conf/conf.py" not in list_www:
214
223
        list_www.append("www/conf/conf.py")
 
224
    # Make sure that console/python-console is in the list
 
225
    if "console/python-console" not in list_console:
 
226
        list_console.append("console/python-console")
215
227
    # Write these out to a file
216
228
    cwd = os.getcwd()
217
229
    # the files that will be created/overwritten
222
234
 
223
235
        file.write("""# IVLE Configuration File
224
236
# install_list.py
225
 
# Provides lists of all Python files to be installed by `setup.py install'.
 
237
# Provides lists of all files to be installed by `setup.py install' from
 
238
# certain directories.
226
239
# Note that any files with the given filename plus 'c' or 'o' (that is,
227
240
# compiled .pyc or .pyo files) will be copied as well.
228
241
 
229
 
# List of all installable Python files in www directory.
 
242
# List of all installable files in www directory.
230
243
list_www = """)
231
244
        writelist_pretty(file, list_www)
232
245
        file.write("""
233
 
# List of all installable Python files in console directory.
 
246
# List of all installable files in console directory.
234
247
list_console = """)
235
248
        writelist_pretty(file, list_console)
236
249
 
258
271
        filter_mutate(lambda x: x[0] != '.', dirnames)
259
272
        # All *.py files are added to the list
260
273
        pylist += [os.path.join(dirpath, item) for item in filenames
261
 
            if item.endswith('.py')]
 
274
            if mimetypes.guess_type(item)[0] in listmake_mimetypes]
262
275
    return pylist
263
276
 
264
277
def writelist_pretty(file, list):