Drop python2 support.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/4/head
Michele Calgaro 1 year ago
parent a635b7dc15
commit f75fae3bd1
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -355,7 +355,7 @@ class SlaveClass(TDEIO.SlaveBase):
############################################################################
def debug(self,msg):
if DEBUG == 0: return
print "tdeioslave:"+str(msg)+"\n"
print("tdeioslave:"+str(msg)+"\n")
sys.stdout.flush()
############################################################################
@ -450,7 +450,7 @@ class RAMDir(object):
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_ACCESS
# The usual octal permission information (rw-r--r-- in this case).
atom.m_long = 0644
atom.m_long = 0o644
entry.append(atom)
# If the stat method is implemented then entries _must_ include
@ -496,7 +496,7 @@ class RAMDir(object):
def debug(self,msg):
if DEBUG == 0: return
print "tdeioslave:"+str(msg)+"\n"
print("tdeioslave:"+str(msg)+"\n")
sys.stdout.flush()
############################################################################
@ -583,7 +583,7 @@ class RAMFile(object):
atom = TDEIO.UDSAtom()
atom.m_uds = TDEIO.UDS_ACCESS
# The usual octal permission information (rw-r--r-- in this case).
atom.m_long = 0644
atom.m_long = 0o644
entry.append(atom)
# If the stat method is implemented then entries _must_ include

@ -21,9 +21,8 @@ from distutils import dir_util
import sys
import os
import glob
sys.path.insert(0,"src") # We need this for the import statement below.
import tdedistutils
from src import tdedistutils
def main():
tdedistutils.setup(name="pytdeextensions",
@ -115,7 +114,7 @@ class BuildLibpythonize(Command):
# Python dir
if self.python_dir is None:
self.python_dir = os.path.split(sysconfig.get_config_var("LIBP"))[0]
self.python_dir = os.path.split(sysconfig.get_config_var("LIBPL"))[0]
self.announce("Using %s for the python directory" % self.python_dir)
# Python include dir.
@ -135,12 +134,12 @@ class BuildLibpythonize(Command):
if self.clib!=None:
self.clib = glob.glob(os.path.join(self.clib,'libgcc*.a'))[0]
if self.clib is None:
raise SystemExit, "setup.py: Failed to find a suitable libgcc library"
raise SystemExit("setup.py: Failed to find a suitable libgcc library")
self.announce("Using %s for clib" % self.clib)
# Make a list of places to look for python .so modules
self.python_sub_dirs = sysconfig.get_config_var("LIBSUBDIRS").split()
base = sysconfig.get_config_var("LIBP")
base = sysconfig.get_config_var("LIBPL")
self.python_sub_dirs = [ os.path.join(base,item) for item in self.python_sub_dirs ]
self.python_sub_dirs.append(base)
@ -184,7 +183,7 @@ class BuildLibpythonize(Command):
lines = raw.readlines()
if len(lines):
cflags = lines[0].split('"')[1].split()
print "Got CFLAGS from emerge info."
print("Got CFLAGS from emerge info.")
cmdlist.extend(cflags)
else:
# Still no CFLAGS found, use these ...
@ -202,7 +201,7 @@ class BuildLibpythonize(Command):
cmdlist.append("-o")
cmdlist.append(outputfile)
spawn(cmdlist) # Execute!!!
print
print()
# Link the resulting object file to create a shared library.
cmdlist = ['libtool']
@ -231,7 +230,7 @@ class BuildLibpythonize(Command):
cmdlist.extend(linklist)
spawn(cmdlist) # Execute!!
print
print()
###########################################################################
class InstallLibpythonize(Command):
@ -298,7 +297,7 @@ class InstallLibpythonize(Command):
cmdlist.append(os.path.join(self.build_dir,"libpythonize.la"))
cmdlist.append(os.path.join(self.install_dir,"libpythonize.la"))
spawn(cmdlist) # Execute!!
print
print()
# Work the names of the files that were installed.
self.outfiles = []
@ -317,7 +316,7 @@ class InstallLibpythonize(Command):
def get_outputs(self):
return self.outfiles
def mkpath(self, name, mode=0777):
def mkpath(self, name, mode=0o777):
return dir_util.mkpath(name, mode, dry_run=self.dry_run)
main()

@ -82,7 +82,7 @@ def DynamicImport(importargs,kde=False):
UpdateUI(file_name_ui,kde)
except:
traceback.print_exc()
raise ImportError, "Unable to compile Qt designer file %s." % args[0]
raise ImportError("Unable to compile Qt designer file %s." % args[0])
############################################################################
def UpdateUI(ui_file,kde=False):
@ -100,9 +100,9 @@ def UpdateUI(ui_file,kde=False):
def main():
# FIXME parse args and add --kde parameter.
if len(sys.argv)!=3:
print """\nUsage:
print("""\nUsage:
qtuicompiler filename.ui filename.py\n\n
"""
""")
return
CompileUI(sys.argv[1],sys.argv[2])

@ -31,11 +31,11 @@ from distutils import log
from distutils import file_util
from distutils import dir_util
from distutils.util import byte_compile
import qtuicompiler
from src import qtuicompiler
import stat
import os,os.path,imp,glob
import sys
from types import StringType
from types import *
INSTALL_LIST = 'install_log.txt'
@ -68,12 +68,12 @@ def setup(**arg_dict):
'build_tdeioslave' : BuildTdeioslave,
'install_tdeioslave' : InstallTdeioslave}
for key in kdecmdclass.iterkeys():
for key in kdecmdclass.keys():
cmdclass.setdefault(key,kdecmdclass[key])
arg_dict.setdefault('distclass',KDEDistribution)
apply(distutils.core.setup,[],arg_dict)
distutils.core.setup(*[], **arg_dict)
###########################################################################
class KDEDistribution(Distribution):
@ -149,7 +149,7 @@ class BuildKDE(build):
canidatepaths.append( ask_kde_config('--install exe --expandvars').strip() )
self.msgfmt_exe = FindExeOnPath('msgfmt',canidatepaths)
if self.msgfmt_exe is None:
raise SystemExit, "Unable to find 'msgfmt', needed to build i18n messages."
raise SystemExit("Unable to find 'msgfmt', needed to build i18n messages.")
if self.meinproc_exe is None:
# Find meinproc
@ -157,7 +157,7 @@ class BuildKDE(build):
canidatepaths.append( ask_kde_config('--install exe --expandvars').strip() )
self.meinproc_exe = FindExeOnPath('meinproc',canidatepaths)
if self.meinproc_exe is None:
raise SystemExit, "Unable to find 'meinproc', needed to generate Docbook HTML documentation."
raise SystemExit("Unable to find 'meinproc', needed to generate Docbook HTML documentation.")
###########################################################################
def has_executable_links(self):
@ -247,7 +247,7 @@ class InstallKDE(install):
# Ok, time to find the install command.
self.install_cmd = find_executable('install')
if self.install_cmd is None:
raise SystemExit, "Unable to find the 'install' command, needed to install libraries."
raise SystemExit("Unable to find the 'install' command, needed to install libraries.")
self.announce(" ...'install' command is %s" % self.install_cmd)
if self.install_xdg_apps is None:
@ -309,7 +309,7 @@ class InstallApplicationDataAndLinks(install_data):
def run(self):
self.outfiles.extend(self.mkpath(self.install_dir))
for f in self.data_files:
if type(f) is StringType:
if type(f) is type('String'):
# it's a simple file, so copy it
f = convert_path(f)
if self.warn_dir:
@ -372,7 +372,7 @@ class InstallApplicationDataAndLinks(install_data):
# Add the .pyc files to the list of outfiles.
self.outfiles.extend( [item+'c' for item in self.outfiles if item.endswith('.py')] )
def mkpath(self, name, mode=0777):
def mkpath(self, name, mode=0o777):
return dir_util.mkpath(name, mode, dry_run=self.dry_run)
###########################################################################
@ -414,7 +414,7 @@ class InstallExecutableLinks(Command):
def get_outputs(self):
return self.outfiles or []
def mkpath(self, name, mode=0777):
def mkpath(self, name, mode=0o777):
return dir_util.mkpath(name, mode, dry_run=self.dry_run)
###########################################################################
@ -471,7 +471,7 @@ class Uninstall(Command):
if not self.dry_run:
try:
os.remove(item)
except OSError, details:
except OSError as details:
self.warn("Could not remove file: %s" % details)
elif not os.path.isdir(item):
self.announce("skipping removal of '%s' (does not exist)" % item)
@ -487,7 +487,7 @@ class Uninstall(Command):
if not self.dry_run:
try:
os.rmdir(item)
except OSError, details:
except OSError as details:
self.warn("Could not remove directory: %s" % details)
###########################################################################
@ -543,9 +543,9 @@ class BuildKControlModule(Command):
canidatepaths.append(os.path.join(self.install_prefix,'include','tde'))
self.kde_inc_dir = FindFileInPaths('tdeapplication.h',canidatepaths)
if self.kde_inc_dir is None:
raise SystemExit, "Failed to find the KDE header file directory."
raise SystemExit("Failed to find the TDE header file directory.")
if FindFileInPaths('tdeapplication.h',[self.kde_inc_dir]) is None:
raise SystemExit, "Failed to find KDE header files in: %s" % self.kde_inc_dir
raise SystemExit("Failed to find TDE header files in: %s" % self.kde_inc_dir)
self.announce("Using %s for KDE header files" % self.kde_inc_dir)
# KDE lib dir
@ -557,10 +557,10 @@ class BuildKControlModule(Command):
if self.kde_kcm_lib_dir is None:
self.kde_kcm_lib_dir = os.path.join(self.kde_lib_dir,"trinity")
if FindFileInPaths('*kcm*.so',[self.kde_kcm_lib_dir]) is None:
raise SystemExit, "Failed to find KDE KCM files in: %s" % self.kde_kcm_lib_dir
raise SystemExit("Failed to find TDE KCM files in: %s" % self.kde_kcm_lib_dir)
self.announce("Using %s for KDE KCM library files" % self.kde_kcm_lib_dir)
# Qt inc dir
# TQt inc dir
if self.qt_inc_dir is None:
canidatepaths = []
qtinc = os.getenv("QTINC")
@ -573,22 +573,18 @@ class BuildKControlModule(Command):
canidatepaths.append(os.path.join(install.prefix,"lib/qt3/include"))
canidatepaths.append(os.path.join(install.prefix,"include"))
canidatepaths.append("/opt/tqt3/include")
canidatepaths.append("/opt/qt/include")
canidatepaths.append("/opt/qt/lib/include")
canidatepaths.append("/opt/qt3/lib/include")
canidatepaths.append("/usr/include/tqt3")
canidatepaths.append("/usr/include/qt3")
canidatepaths.append("/usr/include/tqt3")
self.qt_inc_dir = FindFileInPaths('ntqstring.h',canidatepaths)
if self.qt_inc_dir is None:
self.qt_inc_dir = FindFileInPaths('qstring.h',canidatepaths)
if self.qt_inc_dir is None:
raise SystemExit,"Failed to find the Qt header file directory"
raise SystemExit("Failed to find the TQt header file directory")
if FindFileInPaths('ntqstring.h',[self.qt_inc_dir]) is None:
if FindFileInPaths('qstring.h',[self.qt_inc_dir]) is None:
raise SystemExit, "Failed to find Qt header files in: %s" % self.qt_inc_dir
self.announce("Using %s for Qt header files" % self.qt_inc_dir)
raise SystemExit("Failed to find TQt header files in: %s" % self.qt_inc_dir)
self.announce("Using %s for TQt header files" % self.qt_inc_dir)
# Qt lib dir
# TQt lib dir
if self.qt_lib_dir is None:
canidatepaths = []
tqtlib = os.getenv("TQTLIB")
@ -622,12 +618,12 @@ class BuildKControlModule(Command):
canidatepaths.append("/opt/qt3/lib/"+get_libdir_name())
self.qt_lib_dir = FindFileInPaths('libtqt*',canidatepaths)
if self.qt_lib_dir is None:
raise SystemExit, "Failed to find Qt library files"
self.announce("Using %s for Qt library files" % self.qt_lib_dir)
raise SystemExit("Failed to find TQt library files")
self.announce("Using %s for TQt library files" % self.qt_lib_dir)
# Python dir
if self.python_dir is None:
self.python_dir = os.path.split(sysconfig.get_config_var("LIBP"))[0]
self.python_dir = os.path.split(sysconfig.get_config_var("LIBPL"))[0]
self.announce("Using %s for the python directory" % self.python_dir)
# Python include dir.
@ -636,20 +632,20 @@ class BuildKControlModule(Command):
self.python_inc_dir = sysconfig.get_config_var("INCLUDEPY")
self.announce("Using %s for Python header files" % self.python_inc_dir)
# PyQt dir
# PyTQt dir
if self.pyqt_dir is None:
self.pyqt_dir = FindFileInPaths("PyTQt", sys.path)
if self.pyqt_dir is None:
self.pyqt_dir = os.path.join(sysconfig.get_python_lib(), 'PyTQt')
if (FindFileInPaths("libtqtcmodule*",[self.pyqt_dir]) is None) and (FindFileInPaths("qt*",[self.pyqt_dir]) is None):
raise SystemExit, "Failed to find the PyQt directory: %s" % self.pyqt_dir
self.announce("Using %s for PyQt modules" % self.pyqt_dir)
raise SystemExit("Failed to find the PyTQt directory: %s" % self.pyqt_dir)
self.announce("Using %s for PyTQt modules" % self.pyqt_dir)
# PyTDE dir
if self.pytde_dir is None:
self.pytde_dir = sysconfig.get_python_lib()
if (FindFileInPaths("libtdecorecmodule*",[self.pytde_dir]) is None) and (FindFileInPaths("tdecore*",[self.pytde_dir]) is None):
raise SystemExit, "Failed to find the PyTDE directory: %s" % self.pytde_dir
raise SystemExit("Failed to find the PyTDE directory: %s" % self.pytde_dir)
self.announce("Using %s for PyTDE modules" % self.pytde_dir)
# Sip dir
@ -658,7 +654,7 @@ class BuildKControlModule(Command):
if self.sip_dir is None:
self.sip_dir = sysconfig.get_python_lib()
if (FindFileInPaths("libsip_tqt*", [self.sip_dir]) is None) and (FindFileInPaths("sip_tqt*", [self.sip_dir]) is None):
raise SystemExit, "Failed to find libsip files in directory: %s" % self.sip_dir
raise SystemExit("Failed to find libsip files in directory: %s" % self.sip_dir)
self.announce("Using %s for libsip files" % self.sip_dir)
# Find the C library (libgcc, libgcc_s or some other variation).
@ -672,12 +668,12 @@ class BuildKControlModule(Command):
if self.clib!=None:
self.clib = glob.glob(os.path.join(self.clib,'libgcc*.a'))[0]
if self.clib is None:
raise SystemExit, "tdedistutils.py (1): Failed to find a suitable libgcc library"
raise SystemExit("tdedistutils.py (1): Failed to find a suitable libgcc library")
self.announce("Using %s for clib" % self.clib)
# Make a list of places to look for python .so modules
self.python_sub_dirs = sysconfig.get_config_var("LIBSUBDIRS").split()
base = sysconfig.get_config_var("LIBP")
base = sysconfig.get_config_var("LIBPL")
self.python_sub_dirs = [ os.path.join(base,item) for item in self.python_sub_dirs ]
self.python_sub_dirs.append(base)
@ -719,15 +715,15 @@ class BuildKControlModule(Command):
pass
fhandle.close()
except IOError:
raise SystemExit, "Failed to find kcontrol desktop file: %s" % moduletuple[0]
raise SystemExit("Failed to find kcontrol desktop file: %s" % moduletuple[0])
# Sanity check.
if factoryfunction is None:
raise SystemExit, "Failed to find factory name (Was there a X-TDE-FactoryName entry in the desktop file?)"
raise SystemExit("Failed to find factory name (Was there a X-TDE-FactoryName entry in the desktop file?)")
if libraryname is None:
raise SystemExit, "Failed to find library name (Was there a X-TDE-Library entry in the desktop file?)"
raise SystemExit("Failed to find library name (Was there a X-TDE-Library entry in the desktop file?)")
if cmodulecategory is None:
raise SystemExit, "Failed to find the kcontrol category name (Was there a Exec entry in the desktop file?)"
raise SystemExit("Failed to find the kcontrol category name (Was there a Exec entry in the desktop file?)")
modulename = os.path.basename(moduletuple[1])
if modulename.endswith('.py'):
@ -753,7 +749,7 @@ class BuildKControlModule(Command):
fhandle.write(cppcode)
fhandle.close()
except IOError:
raise SystemExit, "Could not write the C++ stub: %s" % cppfile
raise SystemExit("Could not write the C++ stub: %s" % cppfile)
# Compile the stub library.
cmdlist = ['libtool']
@ -786,7 +782,7 @@ class BuildKControlModule(Command):
lines = raw.readlines()
if len(lines):
cflags = lines[0].split('"')[1].split()
print "Got CFLAGS from emerge info."
print("Got CFLAGS from emerge info.")
cmdlist.extend(cflags)
else:
# Still no CFLAGS found, use these ...
@ -810,7 +806,7 @@ class BuildKControlModule(Command):
cmdlist.append("-o")
cmdlist.append(outputfile)
spawn(cmdlist) # Execute!!!
print
print()
# Link the resulting object file to create a shared library.
cmdlist = ['libtool']
@ -862,7 +858,7 @@ class BuildKControlModule(Command):
cmdlist.extend(linklist)
spawn(cmdlist) # Execute!!
print
print()
cpptemplate = r"""
/*
@ -1093,12 +1089,12 @@ class InstallKControlModule(Command):
pass
fhandle.close()
except IOError:
raise SystemExit, "Failed to find kcontrol desktop file: %s" % moduletuple[0]
raise SystemExit("Failed to find kcontrol desktop file: %s" % moduletuple[0])
if libraryname is None:
raise SystemExit, "Failed to find library name (Was there a X-TDE-Library entry in the desktop file?)"
raise SystemExit("Failed to find library name (Was there a X-TDE-Library entry in the desktop file?)")
if cmodulecategory is None:
raise SystemExit, "Failed to find the kcontrol category name (Was there a Exec entry in the desktop file?)"
raise SystemExit("Failed to find the kcontrol category name (Was there a Exec entry in the desktop file?)")
desktopfilename = moduletuple[0]
self.outfiles.extend(self.mkpath(self.xdg_apps_dir))
@ -1117,7 +1113,7 @@ class InstallKControlModule(Command):
cmdlist.append(os.path.join(self.build_dir,stub_la_name))
cmdlist.append(os.path.join(self.install_dir,stub_la_name))
spawn(cmdlist) # Execute!!
print
print()
self.outfiles = [os.path.join(self.install_dir,os.path.basename(file)) for file in glob.glob(os.path.join(self.build_dir,'.libs','kcm_'+libraryname+'*'))]
self.outfiles.append(desktopfile_dest)
@ -1127,7 +1123,7 @@ class InstallKControlModule(Command):
def get_outputs(self):
return self.outfiles or []
def mkpath(self, name, mode=0777):
def mkpath(self, name, mode=0o777):
return dir_util.mkpath(name, mode, dry_run=self.dry_run)
###########################################################################
@ -1155,7 +1151,7 @@ class BuildDocbookHTML(Command):
indexdoc_file_name = os.path.join(input_dir,'index.docbook')
if not os.path.exists(indexdoc_file_name):
raise SystemExit, "File %s is missing." % indexdoc_file_name
raise SystemExit("File %s is missing." % indexdoc_file_name)
cwd = os.getcwd()
os.chdir(input_dir)
@ -1214,7 +1210,7 @@ class InstallDocbookHTML(Command):
self.announce("Install Docbook documentation from directory %s." % input_dir)
source_file = os.path.join(input_dir,'index.cache.bz2')
if not os.path.exists(source_file):
raise SystemExit, "File %s is missing." % source_file
raise SystemExit("File %s is missing." % source_file)
dest_path = os.path.join(self.install_dir, language_code, self.distribution.metadata.name)
self.outfiles.extend(self.mkpath(dest_path))
@ -1246,7 +1242,7 @@ class InstallDocbookHTML(Command):
def get_outputs(self):
return self.outfiles or []
def mkpath(self, name, mode=0777):
def mkpath(self, name, mode=0o777):
return dir_util.mkpath(name, mode, dry_run=self.dry_run)
###########################################################################
@ -1274,7 +1270,7 @@ class UpdateI18NMessages(Command):
canidate_paths.append(ask_kde_config('--install exe --expandvars').strip())
self.xgettext_exe = FindExeOnPath('xgettext',canidate_paths)
if self.xgettext_exe is None:
raise SystemExit, "Unable to find 'xgettext'."
raise SystemExit("Unable to find 'xgettext'.")
self.announce(" ...xgettext found at %s" % self.xgettext_exe)
if self.msgmerge_exe is None:
@ -1288,7 +1284,7 @@ class UpdateI18NMessages(Command):
canidate_paths.append(ask_kde_config('--install exe --expandvars').strip())
self.msgmerge_exe = FindExeOnPath('msgmerge',canidate_paths)
if self.msgmerge_exe is None:
raise SystemExit, "Unable to find 'xgettext'."
raise SystemExit("Unable to find 'xgettext'.")
self.announce(" ...msgmerge found at %s" % self.msgmerge_exe)
if self.kde_pot is None:
@ -1304,7 +1300,7 @@ class UpdateI18NMessages(Command):
kde_pot_dir = FindFileInPaths('kde.pot',canidatepaths)
if kde_pot_dir is None:
raise SystemExit, "Failed to find the kde.pot file."
raise SystemExit("Failed to find the kde.pot file.")
self.kde_pot = os.path.join(kde_pot_dir,'kde.pot')
self.announce(" ...kde.pot found at %s" % self.kde_pot)
@ -1437,7 +1433,7 @@ class InstallI18NMessages(Command):
def get_outputs(self):
return self.outfiles
def mkpath(self, name, mode=0777):
def mkpath(self, name, mode=0o777):
return dir_util.mkpath(name, mode, dry_run=self.dry_run)
@ -1496,9 +1492,9 @@ class BuildTdeioslave(Command):
canidatepaths.append(os.path.join(self.install_prefix,'include','tde'))
self.kde_inc_dir = FindFileInPaths('tdeapplication.h',canidatepaths)
if self.kde_inc_dir is None:
raise SystemExit, "Failed to find the KDE header file directory."
raise SystemExit("Failed to find the TDE header file directory.")
if FindFileInPaths('tdeapplication.h',[self.kde_inc_dir]) is None:
raise SystemExit, "Failed to find KDE header files in: %s" % self.kde_inc_dir
raise SystemExit("Failed to find TDE header files in: %s" % self.kde_inc_dir)
self.announce("Using %s for KDE header files" % self.kde_inc_dir)
# KDE lib dir
@ -1510,10 +1506,10 @@ class BuildTdeioslave(Command):
if self.kde_tdeioslave_lib_dir is None:
self.kde_tdeioslave_lib_dir = os.path.join(self.kde_lib_dir,"trinity")
if FindFileInPaths('tdeio_*.so',[self.kde_tdeioslave_lib_dir]) is None:
raise SystemExit, "Failed to find KDE Tdeioslave library files in: %s" % self.kde_tdeioslave_lib_dir
raise SystemExit("Failed to find TDE Tdeioslave library files in: %s" % self.kde_tdeioslave_lib_dir)
self.announce("Using %s for KDE Tdeioslave library files" % self.kde_tdeioslave_lib_dir)
# Qt inc dir
# TQt inc dir
if self.qt_inc_dir is None:
canidatepaths = []
qtinc = os.getenv("QTINC")
@ -1533,13 +1529,13 @@ class BuildTdeioslave(Command):
if self.qt_inc_dir is None:
self.qt_inc_dir = FindFileInPaths('qstring.h',canidatepaths)
if self.qt_inc_dir is None:
raise SystemExit,"Failed to find the Qt header file directory"
raise SystemExit("Failed to find the TQt header file directory")
if FindFileInPaths('ntqstring.h',[self.qt_inc_dir]) is None:
if FindFileInPaths('qstring.h',[self.qt_inc_dir]) is None:
raise SystemExit, "Failed to find Qt header files in: %s" % self.qt_inc_dir
self.announce("Using %s for Qt header files" % self.qt_inc_dir)
raise SystemExit("Failed to find TQt header files in: %s" % self.qt_inc_dir)
self.announce("Using %s for TQt header files" % self.qt_inc_dir)
# Qt lib dir
# TQt lib dir
if self.qt_lib_dir is None:
canidatepaths = []
tqtlib = os.getenv("TQTLIB")
@ -1573,12 +1569,12 @@ class BuildTdeioslave(Command):
canidatepaths.append("/opt/qt3/lib/"+get_libdir_name())
self.qt_lib_dir = FindFileInPaths('libtqt*',canidatepaths)
if self.qt_lib_dir is None:
raise SystemExit, "Failed to find Qt library files"
self.announce("Using %s for Qt library files" % self.qt_lib_dir)
raise SystemExit("Failed to find TQt library files")
self.announce("Using %s for TQt library files" % self.qt_lib_dir)
# Python dir
if self.python_dir is None:
self.python_dir = os.path.split(sysconfig.get_config_var("LIBP"))[0]
self.python_dir = os.path.split(sysconfig.get_config_var("LIBPL"))[0]
self.announce("Using %s for the python directory" % self.python_dir)
# Python include dir.
@ -1587,20 +1583,20 @@ class BuildTdeioslave(Command):
self.python_inc_dir = sysconfig.get_config_var("INCLUDEPY")
self.announce("Using %s for Python header files" % self.python_inc_dir)
# PyQt dir
# PyTQt dir
if self.pyqt_dir is None:
self.pyqt_dir = FindFileInPaths("PyTQt", sys.path)
if self.pyqt_dir is None:
self.pyqt_dir = os.path.join(sysconfig.get_python_lib(), 'PyTQt')
if (FindFileInPaths("libtqtcmodule*",[self.pyqt_dir]) is None) and (FindFileInPaths("qt*",[self.pyqt_dir]) is None):
raise SystemExit, "Failed to find the PyQt directory: %s" % self.pyqt_dir
self.announce("Using %s for PyQt modules" % self.pyqt_dir)
raise SystemExit("Failed to find the PyTQt directory: %s" % self.pyqt_dir)
self.announce("Using %s for PyTQt modules" % self.pyqt_dir)
# PyTDE dir
if self.pytde_dir is None:
self.pytde_dir = sysconfig.get_python_lib()
if (FindFileInPaths("libtdecorecmodule*",[self.pytde_dir]) is None) and (FindFileInPaths("tdecore*",[self.pytde_dir]) is None):
raise SystemExit, "Failed to find the PyTDE directory: %s" % self.pytde_dir
raise SystemExit("Failed to find the PyTDE directory: %s" % self.pytde_dir)
self.announce("Using %s for PyTDE modules" % self.pytde_dir)
# Sip dir
@ -1609,7 +1605,7 @@ class BuildTdeioslave(Command):
if self.sip_dir is None:
self.sip_dir = sysconfig.get_python_lib()
if (FindFileInPaths("libsip_tqt*", [self.sip_dir]) is None) and (FindFileInPaths("sip_tqt*", [self.sip_dir]) is None):
raise SystemExit, "Failed to find libsip files in directory: %s" % self.sip_dir
raise SystemExit("Failed to find libsip files in directory: %s" % self.sip_dir)
self.announce("Using %s for libsip files" % self.sip_dir)
# Find the C library (libgcc, libgcc_s or some other variation).
@ -1623,12 +1619,12 @@ class BuildTdeioslave(Command):
if self.clib!=None:
self.clib = glob.glob(os.path.join(self.clib,'libgcc*.a'))[0]
if self.clib is None:
raise SystemExit, "tdedistutils.py (2): Failed to find a suitable libgcc library"
raise SystemExit("tdedistutils.py (2): Failed to find a suitable libgcc library")
self.announce("Using %s for clib" % self.clib)
# Make a list of places to look for python .so modules
self.python_sub_dirs = sysconfig.get_config_var("LIBSUBDIRS").split()
base = sysconfig.get_config_var("LIBP")
base = sysconfig.get_config_var("LIBPL")
self.python_sub_dirs = [ os.path.join(base,item) for item in self.python_sub_dirs ]
self.python_sub_dirs.append(base)
@ -1661,11 +1657,11 @@ class BuildTdeioslave(Command):
pass
fhandle.close()
except IOError:
raise SystemExit, "Failed to find tdeioslave protocol file: %s" % moduletuple[0]
raise SystemExit("Failed to find tdeioslave protocol file: %s" % moduletuple[0])
# Sanity check.
if libraryname is None:
raise SystemExit, "Failed to find library name (Was there a exec entry in the protocol file?)"
raise SystemExit("Failed to find library name (Was there a exec entry in the protocol file?)")
modulename = os.path.basename(moduletuple[1])
if modulename.endswith('.py'):
@ -1688,7 +1684,7 @@ class BuildTdeioslave(Command):
fhandle.write(cppcode)
fhandle.close()
except IOError:
raise SystemExit, "Could not write the C++ stub: %s" % cppfile
raise SystemExit("Could not write the C++ stub: %s" % cppfile)
# Compile the stub library.
cmdlist = ['libtool']
@ -1721,7 +1717,7 @@ class BuildTdeioslave(Command):
lines = raw.readlines()
if len(lines):
cflags = lines[0].split('"')[1].split()
print "Got CFLAGS from emerge info."
print("Got CFLAGS from emerge info.")
cmdlist.extend(cflags)
else:
# Still no CFLAGS found, use these ...
@ -1745,7 +1741,7 @@ class BuildTdeioslave(Command):
cmdlist.append("-o")
cmdlist.append(outputfile)
spawn(cmdlist) # Execute!!!
print
print()
# Link the resulting object file to create a shared library.
cmdlist = ['libtool']
@ -1770,13 +1766,13 @@ class BuildTdeioslave(Command):
# FIXME I doubt half of these libraries need to be here.
linklist.append(self.sip_dir+"/sip_tqt.so")
# PyQt libs
# PyTQt libs
linklist.append(self.pyqt_dir+"/qt.so")
# PyTDE libs
linklist.append(self.pytde_dir+"/tdecore.so")
# linklist.append("-L"+self.sip_dir); linklist.append("-lsip_tqt")
# # PyQt libs
# # PyTQt libs
# linklist.append("-L"+self.pyqt_dir); linklist.append("-lqtcmodule")
# # PyTDE libs
# linklist.append("-L"+self.pytde_dir); linklist.append("-ltdecorecmodule"); linklist.append("-ltdeuicmodule")
@ -1796,7 +1792,7 @@ class BuildTdeioslave(Command):
cmdlist.extend(linklist)
spawn(cmdlist) # Execute!!
print
print()
cpptemplate = r"""
/*
@ -1979,10 +1975,10 @@ class InstallTdeioslave(Command):
pass
fhandle.close()
except IOError:
raise SystemExit, "Failed to find tdeioslave protocol file: %s" % moduletuple[0]
raise SystemExit("Failed to find tdeioslave protocol file: %s" % moduletuple[0])
if libraryname is None:
raise SystemExit, "Failed to find library name (Was there a exec entry in the protocol file?)"
raise SystemExit("Failed to find library name (Was there a exec entry in the protocol file?)")
self.outfiles.extend(self.mkpath(self.install_protocol_dir))
protocolfile_dest = os.path.join(self.install_protocol_dir,os.path.basename(protocolfilename))
@ -2000,7 +1996,7 @@ class InstallTdeioslave(Command):
cmdlist.append(os.path.join(self.build_dir,stub_la_name))
cmdlist.append(os.path.join(self.install_dir,stub_la_name))
spawn(cmdlist) # Execute!!
print
print()
self.outfiles = [os.path.join(self.install_dir,os.path.basename(file)) for file in glob.glob(os.path.join(self.build_dir,'.libs',libraryname+'*'))]
self.outfiles.append(protocolfile_dest)
@ -2010,12 +2006,12 @@ class InstallTdeioslave(Command):
def get_outputs(self):
return self.outfiles or []
def mkpath(self, name, mode=0777):
def mkpath(self, name, mode=0o777):
return dir_util.mkpath(name, mode, dry_run=self.dry_run)
###########################################################################
class CheckPyQt(Command):
description = "Checks for the presence of a working PyQt installation"
description = "Checks for the presence of a working PyTQt installation"
user_options = []
@ -2029,14 +2025,14 @@ class CheckPyQt(Command):
if self.min_qt_version!=None:
qtver,kdever = get_qt_kde_versions()
if compare_versions(self.min_qt_version,qtver)==1:
raise SystemExit, "Your Qt version is too old. Version %s or higher is required, found %s." % (self.min_qt_version,qtver)
self.announce("Found Qt version %s." % qtver)
raise SystemExit("Your TQt version is too old. Version %s or higher is required, found %s." % (self.min_qt_version,qtver))
self.announce("Found TQt version %s." % qtver)
try:
self.announce("Checking for a working PyQt...")
self.announce("Checking for a working PyTQt...")
from PyTQt import qt
self.announce(" ...PyQt is working")
self.announce(" ...PyTQt is working")
except:
raise SystemExit, "Couldn't import Qt! Please make sure that PyQt is installed and working."
raise SystemExit("Couldn't import TQt! Please make sure that PyTQt is installed and working.")
def get_outputs(self): return []
@ -2056,7 +2052,7 @@ class CheckPyTDE(Command):
if self.min_kde_version!=None:
qtver,kdever = get_qt_kde_versions()
if compare_versions(self.min_kde_version,kdever)==1:
raise SystemExit, "Your KDE version is too old. Version %s or higher is required, found %s." % (self.min_kde_version,kdever)
raise SystemExit("Your TDE version is too old. Version %s or higher is required, found %s." % (self.min_kde_version,kdever))
self.announce("Found KDE version %s." % kdever)
self.announce("Checking for a working PyTDE...")
@ -2066,9 +2062,9 @@ class CheckPyTDE(Command):
try:
exec('import ' + k_module)
except:
raise SystemExit, "Error: Couldn't find module '" + k_module + "'. \n" + \
raise SystemExit("Error: Couldn't find module '" + k_module + "'. \n" + \
"Couldn't import KDE! Please make sure that PyTDE is installed and working.\n" + \
"PyTDE is available here: http://www.trinitydesktop.org"
"PyTDE is available here: http://www.trinitydesktop.org")
self.announce(" ...PyTDE is working")
def get_outputs(self): return []

Loading…
Cancel
Save