Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/setup.py
blob: d91d6b703274218351d693973c284abd483ea65e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/python

# setup.py
import os
import subprocess
from setuptools                 import setup
#from distutils.core            import setup

#from distutils.command.install import install
from exe.engine                import version
from exe.engine.path           import Path

# update the svn revision number
REVISION_FILE = 'exe/engine/version_svn.py'

try:
    os.unlink(REVISION_FILE)
except OSError:
    pass

try:
    psvn = subprocess.Popen('svnversion', stdout=subprocess.PIPE)
    psvn.wait()
    revision = psvn.stdout.read().strip()
except OSError:
    revision = None

if revision:
    open(REVISION_FILE, 'wt').write('revision = "%s"\n' % revision)

# Before we install, make sure all the mimetex binaries are executable
Path('exe/webui/templates/mimetex.cgi').chmod(0755)
Path('exe/webui/templates/mimetex.64.cgi').chmod(0755)

files = { '/usr/share/exe': ["README", 
                             "COPYING", 
                             "NEWS", 
                             "ChangeLog",
                             "exe/webui/mr_x.gif"],
          '/usr/share/applications': ["exe.desktop"],
          '/usr/share/icons/hicolor/48x48/apps': ["exe.png"],
        }

def dataFiles(baseSourceDir, baseDestDir, sourceDirs):
    """Recursively get all the files in these directories"""
    global files
    from exe.engine.path import Path
    baseSourceDir = Path(baseSourceDir)
    baseDestDir = Path(baseDestDir)
    sourceDirs = map(Path, sourceDirs)
    for sourceDir in sourceDirs:
        sourceDir = baseSourceDir/sourceDir
        for subDir in list(sourceDir.walkdirs()) + [sourceDir]:
            if set(('CVS', '.svn')) & set(subDir.splitall()):
                continue
            newExtDir = baseSourceDir.relpathto(subDir)
            fileList = files.setdefault(baseDestDir/newExtDir, [])
            fileList += subDir.files()
              
    
# Add all the webui dirs
dataFiles('exe/webui', '/usr/share/exe', 
          ['style', 'css', 'docs', 'images', 'schemas', 'scripts',
           'linux-profile', 'templates'])

# Add in the locale directory
dataFiles('exe', '/usr/share/exe', ['locale'])

# Add our 3rd party library copies
dataFiles('.', '/usr/share/exe', ['twisted', 'nevow', 'formless'])

# Add in the xului directory
dataFiles('exe/xului', '/usr/share/exe', ['scripts', 'templates'])

opts = {
 "bdist_rpm": {
   "requires": ["python-imaging",]
 }
}

setup(name         = version.project,
      version      = version.release,
      description  = "eLearning XHTML editor",
      long_description = """\
The eXe project is an authoring environment to enable teachers
to publish web content without the need to become proficient in
HTML or XML markup.  Content generated using eXe can be used by
any Learning Management System.  
""",
      url          = "http://exelearning.org",
      author       = "eXe Project",
      author_email = "exe@exelearning.org",
      license      = "GPL",
      scripts      = ["exe/exe", "exe/run-exe.sh"],
      packages     = ["exe", "exe.webui", "exe.xului", 
                      "exe.engine", "exe.export"],
      data_files   = files.items(),
      doc_files    = ["NEWS", "Changelog", "COPYING", "README"],
      options      = opts
     )