-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.py
More file actions
142 lines (130 loc) · 4.61 KB
/
Copy pathsetup.py
File metadata and controls
142 lines (130 loc) · 4.61 KB
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
#!/usr/bin/env python
import os
import sys
from setuptools import setup, find_packages
if sys.version_info < (2, 4):
print "Error: You need at least Python 2.4 to use SpamBayes."
print "You're running version %s." % sys.version
sys.exit(0)
# Install
from distutils.core import setup
from spambayes import __version__
import distutils.command.install_scripts
parent = distutils.command.install_scripts.install_scripts
class install_scripts(parent):
old_scripts=[
'unheader',
'hammie',
'hammiecli',
'hammiesrv',
'hammiefilter',
'pop3proxy',
'smtpproxy',
'sb_smtpproxy',
'proxytee',
'dbExpImp',
'mboxtrain',
'imapfilter',
'notesfilter',
]
def run(self):
err = False
for s in self.old_scripts:
s = os.path.join(self.install_dir, s)
for e in (".py", ".pyc", ".pyo"):
if os.path.exists(s+e):
print >> sys.stderr, "Error: old script", s+e,
print >> sys.stderr, "still exists."
err = True
if err:
print >>sys.stderr, "Do you want to delete these scripts? (y/n)"
answer = raw_input("")
if answer == "y":
for s in self.old_scripts:
s = os.path.join(self.install_dir, s)
for e in (".py", ".pyc", ".pyo"):
try:
os.remove(s+e)
print "Removed", s+e
except OSError:
pass
return parent.run(self)
import distutils.command.sdist
sdist_parent = distutils.command.sdist.sdist
class sdist(sdist_parent):
"""Like the standard sdist, but also prints out MD5 checksums and sizes
for the created files, for convenience."""
def run(self):
import md5
retval = sdist_parent.run(self)
for archive in self.get_archive_files():
data = file(archive, "rb").read()
print '\n', archive, "\n\tMD5:", md5.md5(data).hexdigest()
print "\tLength:", len(data)
return retval
scripts=['scripts/sb_client.py',
'scripts/sb_dbexpimp.py',
'scripts/sb_evoscore.py',
'scripts/sb_filter.py',
'scripts/sb_bnfilter.py',
'scripts/sb_bnserver.py',
'scripts/sb_imapfilter.py',
'scripts/sb_mailsort.py',
'scripts/sb_mboxtrain.py',
'scripts/sb_notesfilter.py',
'scripts/sb_pop3dnd.py',
'scripts/sb_server.py',
'scripts/core_server.py',
'scripts/sb_unheader.py',
'scripts/sb_upload.py',
'scripts/sb_xmlrpcserver.py',
'scripts/sb_chkopts.py',
]
if sys.platform == 'win32':
# Also install the pop3proxy_service and pop3proxy_tray scripts.
# pop3proxy_service is only needed for installation and removal,
# but pop3proxy_tray needs to be used all the time. Neither is
# any use on a non-win32 platform.
scripts.append('windows/pop3proxy_service.py')
scripts.append('windows/pop3proxy_tray.py')
if sys.version_info >= (3, 0):
lf_min_version = "0.6"
else:
lf_min_version = "0.2"
setup(
name='spambayes',
version = __version__,
description = "Spam classification system",
author = "the spambayes project",
author_email = "spambayes@python.org",
url = "http://spambayes.sourceforge.net",
install_requires = ["lockfile>=%s" % lf_min_version,
"pydns>=2.0"],
cmdclass = {'install_scripts': install_scripts,
'sdist': sdist,
},
scripts=scripts,
packages = [
'spambayes',
'spambayes.resources',
'spambayes.core_resources',
],
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Environment :: Plugins',
'Environment :: Win32 (MS Windows)',
'License :: OSI Approved :: Python Software Foundation License',
'Operating System :: POSIX',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows :: Windows 95/98/2000',
'Operating System :: Microsoft :: Windows :: Windows NT/2000',
'Natural Language :: English',
'Programming Language :: Python',
'Programming Language :: C',
'Intended Audience :: End Users/Desktop',
'Topic :: Communications :: Email :: Filters',
'Topic :: Communications :: Email :: Post-Office :: POP3',
'Topic :: Communications :: Email :: Post-Office :: IMAP',
],
)