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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
|
'''
Task Coach - Your friendly task manager
Copyright (C) 2004-2014 Task Coach developers <developers@taskcoach.org>
Task Coach is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Task Coach is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
'''
from buildlib import clean, bdist_rpm_fedora, bdist_rpm_opensuse, bdist_deb, \
bdist_winpenpack, bdist_portableapps
from setup import setupOptions
from taskcoachlib import meta
import sys
import os
import glob
import wx
setupOptions['cmdclass'] = dict(clean=clean,
bdist_rpm_fedora=bdist_rpm_fedora,
bdist_rpm_opensuse=bdist_rpm_opensuse,
bdist_deb=bdist_deb,
bdist_winpenpack=bdist_winpenpack,
bdist_portableapps=bdist_portableapps)
distdir = 'dist'
builddir = 'build'
manifest = """
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="0.64.1.0" processorArchitecture="x86"
name="Controls" type="win32"/>
<description>%s</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32"
name="Microsoft.Windows.Common-Controls" version="6.0.0.0"
processorArchitecture="X86" publicKeyToken="6595b64144ccf1df"
language="*"/>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32"
name="Microsoft.VC90.CRT" version="9.0.21022.8"
processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" />
</dependentAssembly>
</dependency>
</assembly>
""" % meta.name
doubleline = '================================================================\n'
header = doubleline + '%(name)s - %(description)s\n' % meta.metaDict + doubleline
aboutText = header + '''
Version %(version)s, %(date)s
By %(author)s <%(author_email)s>
%(url)s
%(copyright)s
%(license)s
''' % meta.metaDict + doubleline
installText = header + '''
--- Prerequisites ----------------------------------------------
You need Python version %(pythonversion)s or higher, wxPython
version %(wxpythonversion)s or higher, and Twisted version
%(twistedversionnumber)s or higher.
--- Testing ----------------------------------------------------
Before installing, you may want to run the unittests included.
Issue the following command:
cd tests; python test.py
If all goes well, you should see a number of dots appearing and
the message 'Ran X tests in Y seconds. OK'. If not, you'll get
one or more failed tests. In that case, please run the tests
again, redirecting the output to a textfile, like this:
python test.py 2> errors.txt
Please mail me the errors.txt file and your platform information
(operating system version, Python version and wxPython version).
--- Installation -----------------------------------------------
There are two options to install %(name)s:
First, you can simply move this directory to some suitable
location and run taskcoach.py (or taskcoach.pyw if you are on
the Windows platform) from there.
Alternatively, you can use the Python distutils setup script
to let Python install %(name)s for you. In that case run the
following command:
python setup.py install
If you have a previous version of %(name)s installed, you may
need to force old files to be overwritten, like this:
python setup.py install --force
''' % meta.metaDict + doubleline
buildText = header + '''
--- Building ---------------------------------------------------
To be done.
''' % meta.metaDict + doubleline
def writeFile(filename, text, directory='.'): # pylint: disable=W0621
if not os.path.exists(directory):
os.mkdir(directory)
with file(os.path.join(directory, filename), 'w') as textFile:
textFile.write(text)
def createDocumentation():
writeFile('README.txt', aboutText)
writeFile('INSTALL.txt', installText)
writeFile('LICENSE.txt', meta.licenseText)
def createInnoSetupScript():
script = file('build.in/windows/taskcoach.iss').read()
writeFile('taskcoach.iss', script % meta.metaDict, builddir)
def createDebianChangelog():
changelog = file('build.in/debian/changelog').read()
writeFile('changelog', changelog % meta.metaDict,
os.path.join(builddir, 'debian'))
if sys.argv[1] == 'py2exe':
from distutils.core import setup
import py2exe # pylint: disable=F0401
import shutil
shutil.copyfile('taskcoach.pyw', 'taskcoach_console.py')
py2exeDistdir = '%s-%s-win32exe' % (meta.filename, meta.version)
# Get .mo files for wxWidgets:
locale_dir = os.path.join(os.path.dirname(wx.__file__), 'locale')
mo_path = os.path.join('LC_MESSAGES', 'wxstd.mo')
mo_files = []
for language_dir in os.listdir(locale_dir):
mo_abs_filename = os.path.join(locale_dir, language_dir, mo_path)
mo_rel_dir = os.path.join('locale', language_dir, 'LC_MESSAGES')
mo_files.append((mo_rel_dir, [mo_abs_filename]))
# DLL's we redistribute so people don't have to download them:
dll_files = [('', ['dist.in/gdiplus.dll']), ('Microsoft.VC90.CRT',
['dist.in/msvcp90.dll',
'dist.in/msvcr90.dll',
'dist.in/Microsoft.VC90.CRT.manifest'])]
setupOptions.update({
'windows': [{'script': 'taskcoach.pyw',
'other_resources': [(24, 1, manifest)],
'icon_resources': [(1, 'icons.in/taskcoach.ico')]}],
'console': [{'script': 'taskcoach_console.py',
'other_resources': [(24, 1, manifest)]}],
'options': {'py2exe': {
'compressed': 1,
'optimize': 2,
# We need to explicitly include these packages because they
# are imported implicitly:
'packages': ['taskcoachlib.i18n',
'taskcoachlib.thirdparty.keyring',
'taskcoachlib.thirdparty.pubsub',
'taskcoachlib.thirdparty.pubsub.core',
'taskcoachlib.thirdparty.pubsub.core.kwargs',
'taskcoachlib.thirdparty._weakrefset'],
'dist_dir': os.path.join(builddir, py2exeDistdir),
'dll_excludes': ['MSVCR80.dll', 'UxTheme.dll']}},
'data_files': dll_files + mo_files})
os.environ['PATH'] = 'dist.in;' + os.environ['PATH']
elif sys.argv[1] == 'py2app':
from setuptools import setup # pylint: disable=W0404
setupOptions.update(dict(app=['taskcoach.py'],
setup_requires=['py2app'],
options=dict(py2app=dict(argv_emulation=True, compressed=True,
dist_dir=os.path.join(builddir, 'Task Coach'), optimize=2, iconfile='icons.in/taskcoach.icns',
# We need to explicitly include i18n modules because they
# are imported implicitly via __import__:
includes=[filename[:-3].replace('/', '.') for filename \
in glob.glob('taskcoachlib/i18n/*.py') + \
glob.glob('taskcoachlib/thirdparty/pubsub/*.py') + \
glob.glob('taskcoachlib/thirdparty/pubsub/core/*.py') + \
glob.glob('taskcoachlib/thirdparty/pubsub/core/kwargs/*.py')],
plist=dict(CFBundleIconFile='taskcoach.icns',
CFBundleDocumentTypes=[dict(CFBundleTypeExtensions=['tsk'],
CFBundleTypeIconFile='taskcoach.icns',
CFBundleTypeName='%s task file' % meta.name,
CFBundleTypeRole='Editor')])))))
elif sys.argv[1] == 'bdist_rpm_fedora':
from distutils.core import setup
spec_file = file('build.in/fedora/taskcoach.spec').read() % meta.metaDict
spec_file = spec_file.split('\n')
setupOptions.update(dict(options=dict(bdist_rpm_fedora=dict(\
spec_file=spec_file, icon='icons.in/taskcoach.png',
desktop_file='build.in/linux_common/taskcoach.desktop'))))
# On Fedora, to keep the rpm build process going when it finds
# unpackaged files you need to create a ~/.rpmmacros file
# containing the line '%_unpackaged_files_terminate_build 0'.
elif sys.argv[1] == 'bdist_rpm_opensuse':
from distutils.core import setup
spec_file = file('build.in/opensuse/taskcoach.spec').read() % meta.metaDict
spec_file = spec_file.split('\n')
setupOptions.update(dict(options=dict(bdist_rpm_opensuse=dict(\
spec_file=spec_file, icon='icons.in/taskcoach.png',
desktop_file='build.in/linux_common/taskcoach.desktop'))))
elif sys.argv[1] in ['bdist_deb', 'bdist_ubuntu']:
from distutils.core import setup
bdist_deb = dict(\
package=meta.data.filename_lower, title=meta.data.name,
description=meta.data.description,
long_description=meta.data.long_description,
version=meta.data.version,
author=meta.data.author, author_email=meta.data.author_email,
copyright=meta.data.copyright,
license=meta.data.license_title_and_version,
license_abbrev=meta.data.license_title_and_version_abbrev,
license_path='/usr/share/common-licenses/GPL-3',
license_summary=meta.data.license_notice,
wxpythonversion=meta.data.wxpythonversionnumber,
twistedversion=meta.data.twistedversionnumber,
subsection='Office', url=meta.data.url,
command='/usr/bin/taskcoach.py',
changelog_content=file('changelog_content', 'rb').read().rstrip(),
sdist_exclude='buildlib')
if sys.argv[1] == 'bdist_ubuntu':
bdist_deb['distribution'] = sys.argv[2]
bdist_deb['version'] = '%s-0ubuntu%s~%s' % (meta.version, sys.argv[3], sys.argv[2])
bdist_deb['section'] = 'editors'
sys.argv[1] = 'bdist_deb'
del sys.argv[2]
del sys.argv[2]
setupOptions.update(dict(options=dict(bdist_deb=bdist_deb)))
elif sys.argv[1] == 'bdist_winpenpack':
from distutils.core import setup
setupOptions.update(dict(options=dict(bdist_winpenpack=dict(\
version=meta.data.version,
license=meta.data.license_title,
url=meta.data.url,
filename=meta.data.filename,
date=meta.data.date))))
elif sys.argv[1] == 'bdist_portableapps':
from distutils.core import setup
setupOptions.update(dict(options=dict(bdist_portableapps=dict(\
name=meta.data.name,
version=meta.data.version,
license=meta.data.license_title,
url=meta.data.url,
filename=meta.data.filename,
date=meta.data.date))))
else:
from distutils.core import setup
if __name__ == '__main__':
for directory in builddir, distdir:
if not os.path.exists(directory):
os.mkdir(directory)
createDocumentation()
setup(**setupOptions) # pylint: disable=W0142
if sys.argv[1] == 'py2exe':
createInnoSetupScript()
|