ENH: setup.py now automatically runs 2to3 for python3.x

pull/128/head
Steven Hiscocks 2013-04-09 19:40:54 +01:00
parent 77aa523f22
commit a33bf5baca
1 changed files with 29 additions and 18 deletions

View File

@ -23,9 +23,18 @@ __copyright__ = "Copyright (c) 2004 Cyril Jaquier"
__license__ = "GPL"
from distutils.core import setup
try:
# python 3.x
from distutils.command.build_py import build_py_2to3 as build_py
from distutils.command.build_scripts \
import build_scripts_2to3 as build_scripts
except ImportError:
# python 2.x
from distutils.command.build_py import build_py
from distutils.command.build_scripts import build_scripts
from common.version import version
from os.path import isfile, join, isdir
from sys import argv
import sys
from glob import glob
longdesc = '''
@ -45,6 +54,7 @@ setup(
url = "http://www.fail2ban.org",
license = "GPL",
platforms = "Posix",
cmdclass = {'build_py': build_py, 'build_scripts': build_scripts},
scripts = [
'fail2ban-client',
'fail2ban-server',
@ -100,25 +110,26 @@ for directory in elements:
obsoleteFiles.append(path)
if obsoleteFiles:
print
print "Obsolete files from previous Fail2Ban versions were found on " \
"your system."
print "Please delete them:"
print
sys.stdout.write("\n")
sys.stdout.write("Obsolete files from previous Fail2Ban versions " \
"were found on your system.\n")
sys.stdout.write("Please delete them:\n")
sys.stdout.write("\n")
for f in obsoleteFiles:
print "\t" + f
print
sys.stdout.write("\t" + f)
sys.stdout.write("\n")
if isdir("/usr/lib/fail2ban"):
print
print "Fail2ban is not installed under /usr/lib anymore. The new " \
"location is under /usr/share. Please remove the directory " \
"/usr/lib/fail2ban and everything under this directory."
print
sys.stdout.write("\n")
sys.stdout.write("Fail2ban is not installed under /usr/lib anymore. " \
"The new location is under /usr/share. Please remove the " \
"directory /usr/lib/fail2ban and everything under this directory.\n")
sys.stdout.write("\n")
# Update config file
if argv[1] == "install":
print
print "Please do not forget to update your configuration files."
print "They are in /etc/fail2ban/."
print
if sys.argv[1] == "install":
sys.stdout.write("\n")
sys.stdout.write("Please do not forget to update your configuration "
"files.\n")
sys.stdout.write("They are in /etc/fail2ban/.\n")
sys.stdout.write("\n")