summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xapp_templates/kcontrol_module/setup.py4
-rwxr-xr-xapp_templates/kdeapp/setup.py4
-rwxr-xr-xapp_templates/kdeutility/setup.py4
-rwxr-xr-xapp_templates/tdeioslave/setup.py4
-rw-r--r--doc/en/index.docbook8
-rwxr-xr-xsetup.py26
-rw-r--r--src/tdedistutils.py (renamed from src/kdedistutils.py)494
7 files changed, 272 insertions, 272 deletions
diff --git a/app_templates/kcontrol_module/setup.py b/app_templates/kcontrol_module/setup.py
index 6741051..b072cb8 100755
--- a/app_templates/kcontrol_module/setup.py
+++ b/app_templates/kcontrol_module/setup.py
@@ -15,9 +15,9 @@
# #
###########################################################################
-import kdedistutils
+import tdedistutils
-kdedistutils.setup(name="kcontrol_module",
+tdedistutils.setup(name="kcontrol_module",
version="0.1.0",
author="AUTHOR",
author_email="YOUR@EMAIL.com",
diff --git a/app_templates/kdeapp/setup.py b/app_templates/kdeapp/setup.py
index 8cf6964..710c6aa 100755
--- a/app_templates/kdeapp/setup.py
+++ b/app_templates/kdeapp/setup.py
@@ -15,9 +15,9 @@
# #
###########################################################################
-import kdedistutils
+import tdedistutils
-kdedistutils.setup(name="kdeapp",
+tdedistutils.setup(name="kdeapp",
version="0.1.0",
author="AUTHOR",
author_email="YOUR@EMAIL.com",
diff --git a/app_templates/kdeutility/setup.py b/app_templates/kdeutility/setup.py
index ff51c10..3a39382 100755
--- a/app_templates/kdeutility/setup.py
+++ b/app_templates/kdeutility/setup.py
@@ -15,9 +15,9 @@
# #
###########################################################################
-import kdedistutils
+import tdedistutils
-kdedistutils.setup(name="kdeutility",
+tdedistutils.setup(name="kdeutility",
version="0.1.0",
author="AUTHOR",
author_email="YOUR@EMAIL.com",
diff --git a/app_templates/tdeioslave/setup.py b/app_templates/tdeioslave/setup.py
index f2a5468..1e9ff91 100755
--- a/app_templates/tdeioslave/setup.py
+++ b/app_templates/tdeioslave/setup.py
@@ -15,9 +15,9 @@
# #
###########################################################################
-import kdedistutils
+import tdedistutils
-kdedistutils.setup(name="tdeioslave",
+tdedistutils.setup(name="tdeioslave",
version="0.1.0",
author="AUTHOR",
author_email="YOUR@EMAIL.com",
diff --git a/doc/en/index.docbook b/doc/en/index.docbook
index fe2d728..db50244 100644
--- a/doc/en/index.docbook
+++ b/doc/en/index.docbook
@@ -125,20 +125,20 @@ below.
Distutils is based around writing a <filename>setup.py</filename> file which
then uses the distutils package
To use the KDE extensions, the first thing you need to do in your <filename>setup.py
-</filename> file is include the <symbol>kdedistutils</symbol> package.
+</filename> file is include the <symbol>tdedistutils</symbol> package.
<programlisting>
#!/usr/bin/env python
# Setup.py file for MyKDEApplication
-import kdedistutils
+import tdedistutils
</programlisting>
-You need to call the <symbol>setup()</symbol> function from <symbol>kdedistutils</symbol>
+You need to call the <symbol>setup()</symbol> function from <symbol>tdedistutils</symbol>
with all of the configuration information about your application, much like the standard
<symbol>setup()</symbol> from <symbol>distutils</symbol>.
<programlisting>
-kdedistutils.setup(name="pytdeextensions",
+tdedistutils.setup(name="pytdeextensions",
version="0.1.0",
author="Simon Edwards",
author_email="simon@simonzone.com",
diff --git a/setup.py b/setup.py
index 0c7a997..cb7e4b5 100755
--- a/setup.py
+++ b/setup.py
@@ -23,10 +23,10 @@ import os
import glob
sys.path.insert(0,"src") # We need this for the import statement below.
-import kdedistutils
+import tdedistutils
def main():
- kdedistutils.setup(name="pytdeextensions",
+ tdedistutils.setup(name="pytdeextensions",
version="0.4.0",
author="Simon Edwards",
author_email="simon@simonzone.com",
@@ -35,7 +35,7 @@ def main():
min_qt_version = "3.0.0",
license = "LGPL",
package_dir = {'': 'src'},
- py_modules = ["kdedistutils","qtuicompiler","qtdesigner","kdedesigner"],
+ py_modules = ["tdedistutils","qtuicompiler","qtdesigner","kdedesigner"],
application_data = ["app_templates","AUTHORS","ChangeLog","COPYING","INSTALL","NEWS"],
docbooks = [ ('doc/en','en') ],
cmdclass = {
@@ -46,18 +46,18 @@ def main():
)
###########################################################################
-class InstallPyKDEExtensions(kdedistutils.InstallKDE):
- sub_commands = kdedistutils.InstallKDE.sub_commands[:]
+class InstallPyKDEExtensions(tdedistutils.InstallKDE):
+ sub_commands = tdedistutils.InstallKDE.sub_commands[:]
sub_commands.append( ('install_libpythonize',None) )
- user_options = kdedistutils.InstallKDE.user_options
+ user_options = tdedistutils.InstallKDE.user_options
user_options.append( ('install-clib=', None, "installation directory for shared libraries") )
user_options.append( ('install-cheaders=', None, "installation directory for C header files") )
def initialize_options(self):
self.install_clib = None
self.install_cheaders = None
- kdedistutils.InstallKDE.initialize_options(self)
+ tdedistutils.InstallKDE.initialize_options(self)
def finalize_options(self):
if self.install_clib is None:
@@ -65,7 +65,7 @@ class InstallPyKDEExtensions(kdedistutils.InstallKDE):
self.install_clib = os.path.join(self.prefix,'lib')
else:
self.announce("Detecting KDE library directory...")
- self.install_clib = kdedistutils.ask_kde_config('--install lib --expandvars').strip()
+ self.install_clib = tdedistutils.ask_kde_config('--install lib --expandvars').strip()
self.announce(" ...KDE library directory is %s" % self.install_clib)
if self.install_cheaders is None:
@@ -73,10 +73,10 @@ class InstallPyKDEExtensions(kdedistutils.InstallKDE):
self.install_cheaders = os.path.join(self.prefix,'include')
else:
self.announce("Detecting KDE headers directory...")
- self.install_cheaders = os.path.normpath(os.path.join(kdedistutils.ask_kde_config('--install lib --expandvars').strip(),"../include"))
+ self.install_cheaders = os.path.normpath(os.path.join(tdedistutils.ask_kde_config('--install lib --expandvars').strip(),"../include"))
self.announce(" ...KDE library headers is %s" % self.install_cheaders)
- kdedistutils.InstallKDE.finalize_options(self)
+ tdedistutils.InstallKDE.finalize_options(self)
if self.root is not None:
self.change_roots('clib','cheaders')
@@ -126,12 +126,12 @@ class BuildLibpythonize(Command):
# Find the C library (libgcc, libgcc_s or some other variation).
if self.clib is None:
- canidatepaths = ["/usr/"+kdedistutils.get_libdir_name(), "/usr/local/"+kdedistutils.get_libdir_name(), "/usr/lib" ]
- self.clib = kdedistutils.FindFileInPaths("libgcc*.so",canidatepaths)
+ canidatepaths = ["/usr/"+tdedistutils.get_libdir_name(), "/usr/local/"+tdedistutils.get_libdir_name(), "/usr/lib" ]
+ self.clib = tdedistutils.FindFileInPaths("libgcc*.so",canidatepaths)
if self.clib!=None:
self.clib = glob.glob(os.path.join(self.clib,'libgcc*.so'))[0]
else:
- self.clib = kdedistutils.FindFileInPaths("libgcc*.a",canidatepaths)
+ self.clib = tdedistutils.FindFileInPaths("libgcc*.a",canidatepaths)
if self.clib!=None:
self.clib = glob.glob(os.path.join(self.clib,'libgcc*.a'))[0]
if self.clib is None:
diff --git a/src/kdedistutils.py b/src/tdedistutils.py
index ceaa499..4db3b2b 100644
--- a/src/kdedistutils.py
+++ b/src/tdedistutils.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
###########################################################################
-# kdedistutils - description #
+# tdedistutils - description #
# ------------------------------ #
# begin : Thu Apr 21 2005 #
# copyright : (C) 2005 by Simon Edwards #
@@ -26,7 +26,7 @@ from distutils.command.install_data import install_data
from distutils.command.install_lib import install_lib
from distutils.util import change_root, convert_path
from distutils.spawn import find_executable,spawn
-from distutils import sysconfig
+from distutils import sysconfig
from distutils import log
from distutils import file_util
from distutils import dir_util
@@ -59,9 +59,9 @@ def setup(**arg_dict):
arg_dict['cmdclass'] = {}
cmdclass = arg_dict['cmdclass']
-
+
arg_dict.setdefault('data_files',[])
-
+
kdecmdclass = {'install' : InstallKDE,
'install_executable_links' : InstallExecutableLinks,
'install_application_data' : InstallApplicationDataAndLinks,
@@ -139,7 +139,7 @@ class BuildKDE(build):
sub_commands.append( ('build_tdeioslave',has_tdeioslaves) )
sub_commands.append( ('build_html',has_docbook_html) )
sub_commands.append( ('build_messages',has_messages) )
-
+
def __init__(self,dist):
build.__init__(self,dist)
self.has_kcms = has_kcms
@@ -151,10 +151,10 @@ class BuildKDE(build):
self.msgfmt_exe = None
self.meinproc_exe = None
build.initialize_options(self)
-
+
def finalize_options(self):
build.finalize_options(self)
-
+
if self.msgfmt_exe is None:
# Find msgfmt
canidatepaths = []
@@ -162,7 +162,7 @@ class BuildKDE(build):
self.msgfmt_exe = FindExeOnPath('msgfmt',canidatepaths)
if self.msgfmt_exe is None:
raise SystemExit, "Unable to find 'msgfmt', needed to build i18n messages."
-
+
if self.meinproc_exe is None:
# Find meinproc
canidatepaths = []
@@ -188,7 +188,7 @@ class InstallKDE(install):
user_options.append( ('install-kcm=',None,"directory for kcm library files") )
user_options.append( ('install-tdeioslave',None,"directory for tdeioslave library files") )
user_options.append( ('install-protocol',None,"directory for tdeioslave protocol files") )
-
+
sub_commands = install.sub_commands[:]
sub_commands.insert(0, ('checkpytde',None) )
sub_commands.insert(0, ('checkpyqt',None) )
@@ -198,7 +198,7 @@ class InstallKDE(install):
sub_commands.append( ('install_kcm',has_kcms) )
sub_commands.append( ('install_tdeioslave',has_tdeioslaves) )
sub_commands.append( ('install_application_data',has_application_data) )
-
+
def initialize_options(self):
self.kde_prefix = None
self.install_messages = None
@@ -210,11 +210,11 @@ class InstallKDE(install):
self.install_protocol = None
self.install_application_data = None
install.initialize_options(self)
-
+
def finalize_options(self):
# If no install prefix was provided, then we try to detect the KDE install prefix.
self.user_supplied_kde_prefix = True
-
+
if self.install_scripts is None:
if self.kde_prefix is not None:
self.install_scripts = os.path.join(self.kde_prefix,'bin')
@@ -222,7 +222,7 @@ class InstallKDE(install):
self.announce("Detecting TDE 'bin' directory...")
self.install_scripts = ask_kde_config('--install exe --expandvars').strip()
self.announce(" ...TDE 'bin' directory is %s" % self.install_scripts)
-
+
if self.install_application_data is None:
if self.kde_prefix is not None:
self.install_application_data = os.path.join(self.kde_prefix,'share/apps',self.distribution.metadata.name)
@@ -253,7 +253,7 @@ class InstallKDE(install):
self.kde_prefix = ask_kde_config('--prefix').strip()
self.announce(" ...TDE install prefix is %s" % self.kde_prefix)
self.user_supplied_kde_prefix = False
-
+
if self.install_cmd is None:
self.announce("Detecting 'install' command...")
# Ok, time to find the install command.
@@ -261,7 +261,7 @@ class InstallKDE(install):
if self.install_cmd is None:
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:
self.announce("Detecting XDG apps directory...")
self.install_xdg_apps = ask_kde_config('--install xdgdata-apps --expandvars').strip()
@@ -271,29 +271,29 @@ class InstallKDE(install):
self.announce("Detecting kcm library directory...")
self.install_kcm = os.path.join(ask_kde_config('--install lib --expandvars').strip(),'trinity')
self.announce(" ...kcm library directory is %s" % self.install_kcm)
-
+
if self.install_tdeioslave is None:
self.announce("Detecting tdeioslave library directory...")
self.install_tdeioslave = os.path.join(ask_kde_config('--install lib --expandvars').strip(),'trinity')
self.announce(" ...tdeioslave library directory is %s" % self.install_tdeioslave)
-
+
if self.install_protocol is None:
self.announce("Detecting tdeioslave protocol directory...")
self.install_protocol = ask_kde_config('--install services --expandvars').strip()
self.announce(" ...tdeioslave protocol directory is %s" % self.install_protocol)
-
+
install.finalize_options(self)
-
+
if self.root is not None:
self.change_roots('application_data','html','messages','xdg_apps','kcm')
-
+
def get_command_name(self):
return 'install'
-
+
def run(self):
global INSTALL_LIST
install.run(self)
-
+
# Write out the uninstall list.
fhandle = open(INSTALL_LIST,'w')
for item in self.get_outputs():
@@ -305,19 +305,19 @@ class InstallKDE(install):
class InstallApplicationDataAndLinks(install_data):
def get_command_name(self):
return 'install_application_data'
-
+
def initialize_options(self):
install_data.initialize_options(self)
self.data_files = self.distribution.application_data
-
+
def finalize_options(self):
self.set_undefined_options('install',
('install_application_data', 'install_dir'),
('root', 'root'),
('force', 'force'),
)
-
+
def run(self):
self.outfiles.extend(self.mkpath(self.install_dir))
for f in self.data_files:
@@ -369,14 +369,14 @@ class InstallApplicationDataAndLinks(install_data):
else:
(out, _) = self.copy_file(data, dir)
self.outfiles.append(out)
-
+
# Compile the .ui files
install_cmd = self.get_finalized_command('install')
prefix = self.install_dir
if prefix[-1] != os.sep:
prefix = prefix + os.sep
self.outfiles.extend(compile_qtdesigner(self.outfiles, force=1, prefix=prefix, base_dir=install_cmd.prefix, dry_run=self.dry_run))
-
+
# Byte compile the .py files
from distutils.util import byte_compile
byte_compile(self.outfiles, optimize=0, force=1, prefix=prefix, base_dir=install_cmd.prefix, dry_run=self.dry_run)
@@ -386,7 +386,7 @@ class InstallApplicationDataAndLinks(install_data):
def mkpath(self, name, mode=0777):
return dir_util.mkpath(name, mode, dry_run=self.dry_run)
-
+
###########################################################################
class InstallExecutableLinks(Command):
description = "Install symlinks"
@@ -398,20 +398,20 @@ class InstallExecutableLinks(Command):
def finalize_options(self):
pass
-
+
def get_command_name(self):
return 'install_executable_links'
-
+
def run(self):
# FIXME add cmd options?
install_script_cmd = self.get_finalized_command('install_scripts')
install_data_cmd = self.get_finalized_command('install_application_data')
-
+
destination_dir = install_data_cmd.install_dir
-
+
if not os.path.exists(install_script_cmd.install_dir):
self.outfiles.extend(self.mkpath(install_script_cmd.install_dir))
-
+
if self.distribution.executable_links is not None:
for link in self.distribution.executable_links:
symname = os.path.join(install_script_cmd.install_dir,link[0])
@@ -425,29 +425,29 @@ class InstallExecutableLinks(Command):
def get_outputs(self):
return self.outfiles or []
-
+
def mkpath(self, name, mode=0777):
return dir_util.mkpath(name, mode, dry_run=self.dry_run)
-
+
###########################################################################
# Fix the --root option for the install_lib command.
class InstallLibWithRoot(install_lib):
user_options = install_lib.user_options[:]
user_options.append( ('root=',None,"install everything relative to this alternate root directory") )
-
+
def initialize_options(self):
install_lib.initialize_options(self)
self.root = None
-
+
def finalize_options(self):
own_install_dir = self.install_dir is not None
-
+
install_lib.finalize_options(self)
self.set_undefined_options('install', ('root', 'root'))
-
+
if self.root is not None and own_install_dir:
self.install_dir = change_root(self.root, self.install_dir)
-
+
###########################################################################
class Uninstall(Command):
description = "Remove all installed files"
@@ -459,22 +459,22 @@ class Uninstall(Command):
def finalize_options(self):
pass
-
+
def get_command_name(self):
return 'uninstall'
def run(self):
global INSTALL_LIST
-
+
if not os.path.isfile(INSTALL_LIST):
self.announce("Unable to uninstall, can't find the file list %s." % INSTALL_LIST)
return
-
+
# Suck in the file list.
fhandle = open(INSTALL_LIST,'r')
file_list = fhandle.readlines()
fhandle.close()
-
+
# Remove the files first.
for item in file_list:
item = item.strip()
@@ -520,7 +520,7 @@ class BuildKControlModule(Command):
('pyqt-dir=',None,'PyQt module directory'),
('pytde-dir=',None,'PyTDE module directory'),
('data-dir=',None,'installation directory for data (script) files')]
-
+
def initialize_options(self):
self.no_kcontrol = 0
self.build_dir = None
@@ -536,14 +536,14 @@ class BuildKControlModule(Command):
self.pyqt_dir = None
self.pytde_dir = None
self.data_dir = None
-
+
def finalize_options(self):
if self.no_kcontrol==0:
self.set_undefined_options('install', ('build_base', 'build_dir'),('install_application_data','data_dir'))
-
+
install = self.get_finalized_command('install')
self.install_prefix = ask_kde_config('--prefix').strip()
-
+
# KDE inc dir: find it!
if self.kde_inc_dir is None:
canidatepaths = []
@@ -559,19 +559,19 @@ class BuildKControlModule(Command):
if FindFileInPaths('tdeapplication.h',[self.kde_inc_dir]) is None:
raise SystemExit, "Failed to find KDE header files in: %s" % self.kde_inc_dir
self.announce("Using %s for KDE header files" % self.kde_inc_dir)
-
+
# KDE lib dir
if self.kde_lib_dir is None:
self.kde_lib_dir = os.path.join(self.install_prefix,"lib")
self.announce("Using %s for KDE library files" % self.kde_lib_dir)
-
+
# KDE KCM lib dir
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
self.announce("Using %s for KDE KCM library files" % self.kde_kcm_lib_dir)
-
+
# Qt inc dir
if self.qt_inc_dir is None:
canidatepaths = []
@@ -599,7 +599,7 @@ class BuildKControlModule(Command):
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)
-
+
# Qt lib dir
if self.qt_lib_dir is None:
canidatepaths = []
@@ -636,18 +636,18 @@ class BuildKControlModule(Command):
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)
-
+
# Python dir
if self.python_dir is None:
self.python_dir = os.path.split(sysconfig.get_config_var("LIBP"))[0]
self.announce("Using %s for the python directory" % self.python_dir)
-
+
# Python include dir.
if self.python_inc_dir is None:
# Find the Python include directory.
self.python_inc_dir = sysconfig.get_config_var("INCLUDEPY")
self.announce("Using %s for Python header files" % self.python_inc_dir)
-
+
# PyQt dir
if self.pyqt_dir is None:
self.pyqt_dir = m_pyqt_dir
@@ -656,14 +656,14 @@ class BuildKControlModule(Command):
if (FindFileInPaths("libqtcmodule*",[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)
-
+
# 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
self.announce("Using %s for PyTDE modules" % self.pytde_dir)
-
+
# Sip dir
if self.sip_dir is None:
self.sip_dir = m_sip_dir
@@ -672,7 +672,7 @@ class BuildKControlModule(Command):
if (FindFileInPaths("libsip*", [self.sip_dir]) is None) and (FindFileInPaths("sip*", [self.sip_dir]) is None):
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).
if self.clib is None:
canidatepaths = ["/usr/"+get_libdir_name(), "/usr/local/"+get_libdir_name(), "/usr/lib" ]
@@ -684,9 +684,9 @@ 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, "kdedistutils.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")
@@ -700,13 +700,13 @@ class BuildKControlModule(Command):
if self.no_kcontrol:
self.announce("Skipping KControl modules")
return
-
+
if not os.path.isdir(self.build_dir):
os.mkdir(self.build_dir)
-
+
for moduletuple in self.distribution.kcontrol_modules:
self.announce("Building KControl module from desktop file %s." % moduletuple[0])
-
+
# Read the desktop file
factoryfunction = None
libraryname = None
@@ -732,7 +732,7 @@ class BuildKControlModule(Command):
fhandle.close()
except IOError:
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?)"
@@ -740,24 +740,24 @@ class BuildKControlModule(Command):
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?)"
-
+
modulename = os.path.basename(moduletuple[1])
if modulename.endswith('.py'):
modulename = modulename[:-3]
desktopfilename = moduletuple[0]
-
+
stub_cpp_name = 'kcm_'+libraryname+'.cpp'
stub_so_name = 'kcm_'+libraryname+'.so'
stub_la_name = 'kcm_'+libraryname+'.la'
python_version = '%i.%i' % (sys.version_info[0],sys.version_info[1])
-
+
# Build the 'stub' code.
cppcode = self.cpptemplate % {"moduledir": self.data_dir,
"extramodule": os.getenv("EXTRA_MODULE_DIR"),
"modulename": modulename,
"factoryfunction": factoryfunction,
"python_version": python_version}
-
+
# Put it on disk.
cppfile = os.path.join(os.path.dirname(moduletuple[0]),stub_cpp_name)
try:
@@ -766,14 +766,14 @@ class BuildKControlModule(Command):
fhandle.close()
except IOError:
raise SystemExit, "Could not write the C++ stub: %s" % cppfile
-
+
# Compile the stub library.
cmdlist = ['libtool']
# Couldn't get it to pass without this ...
cmdlist.append("--mode=compile")
cmdlist.append("--tag=CXX")
-
+
# Find the compiler flags and options
# CXX is empty on some Systems, let's do it 'the hard way'.
# FIXME :: get CXX from make.conf for Gentoo.
@@ -783,11 +783,11 @@ class BuildKControlModule(Command):
cmdlist.extend(['g++', '-pthread'])
#cmdlist.extend(sysconfig.get_config_var("CXX").split())
-
+
# cc_flags
cmdlist.append("-c")
cmdlist.append("-g")
-
+
# The 4 is randomly chosen!
# FIXME :: get CFLAGS from make.conf for Gentoo.
if len(sysconfig.get_config_var("CFLAGS").split()) >=4:
@@ -803,7 +803,7 @@ class BuildKControlModule(Command):
else:
# Still no CFLAGS found, use these ...
cmdlist.extend(['-fno-strict-aliasing', '-DNDEBUG', '-g', '-O3', '-Wall', '-Wstrict-prototypes'])
-
+
#sysconfig.get_config_var("CFLAGS").split()
# includes
cmdlist.append("-I" + sysconfig.get_config_var("INCLUDEDIR"))
@@ -823,12 +823,12 @@ class BuildKControlModule(Command):
cmdlist.append(outputfile)
spawn(cmdlist) # Execute!!!
print
-
+
# Link the resulting object file to create a shared library.
cmdlist = ['libtool']
cmdlist.append("--mode=link")
cmdlist.append("--tag=LD")
-
+
# Grab the linker command name
cmdlist.append(sysconfig.get_config_var("LDSHARED").split()[0])
# link_flags
@@ -844,7 +844,7 @@ class BuildKControlModule(Command):
linklist = []
linklist.append("-lpython%s" % python_version)
linklist.extend(sysconfig.get_config_var("LIBS").split())
-
+
# FIXME I doubt half of these libraries need to be here.
linklist.append(self.sip_dir+"/sip.so")
# PyQt libs
@@ -852,13 +852,13 @@ class BuildKControlModule(Command):
# PyTDE libs
linklist.append(self.pytde_dir+"/tdecore.so")
linklist.append(self.pytde_dir+"/tdeui.so")
-
+
# linklist.append("-L"+self.sip_dir); linklist.append("-lsip")
# # PyQt libs
# linklist.append("-L"+self.pyqt_dir); linklist.append("-lqtcmodule")
# # PyTDE libs
# linklist.append("-L"+self.pytde_dir); linklist.append("-ltdecorecmodule"); linklist.append("-ltdeuicmodule")
-
+
linklist.append("-L"+self.kde_lib_dir); linklist.append("-L/opt/trinity/lib"); linklist.append("-ltdecore"); linklist.append("-lpythonize")
linklist.append("-L"+self.qt_lib_dir); linklist.append("-ltqt-mt")
linklist.append("-lm")
@@ -875,11 +875,11 @@ class BuildKControlModule(Command):
cmdlist.extend(linklist)
spawn(cmdlist) # Execute!!
print
-
+
cpptemplate = r"""
/*
* pykcm_launcher.cpp
- *
+ *
* Launch Control Centre modules written in Python using an embedded Python
* interpreter.
* Based on David Boddie's PyTDE-components.
@@ -911,11 +911,11 @@ static TDECModule *report_error(char *msg) {
static TDECModule* return_instance( TQWidget *parent, const char *name ) {
TDECModule* tdecmodule;
- PyObject *pyTDECModuleTuple;
+ PyObject *pyTDECModuleTuple;
PyObject *pyTDECModule;
Pythonize *pyize; // Pythonize object to manage the Python interpreter.
int isErr;
-
+
// Try to determine what py script we're loading. Note that "name"
// typically appears to be NULL.
TQString script(MODULE_NAME);
@@ -923,13 +923,13 @@ static TDECModule* return_instance( TQWidget *parent, const char *name ) {
// Reload libpython, but this time tell the runtime linker to make the
// symbols global and available for later loaded libraries/module.
KLibLoader::self()->globalLibrary(LIB_PYTHON);
-
+
// Start the interpreter.
pyize = initialize();
if (!pyize) {
return report_error ("***Failed to start interpreter\n");
}
-
+
// Add the path to the python script to the interpreter search path.
TQString path = TQString(MODULE_DIR);
if(path == TQString::null) {
@@ -944,7 +944,7 @@ static TDECModule* return_instance( TQWidget *parent, const char *name ) {
if(!pyize->appendToSysPath (extrapath.latin1 ())) {
return report_error ("***Failed to set extra sys.path\n");
}
-
+
// Load the Python script.
PyObject *pyModule = pyize->importModule ((char *)script.latin1 ());
if(!pyModule) {
@@ -959,7 +959,7 @@ static TDECModule* return_instance( TQWidget *parent, const char *name ) {
" if parent!=0:\n"
#if SIP_VERSION >= 0x040200
" wparent = sip.wrapinstance(parent,qt.TQWidget)\n"
-#else
+#else
" wparent = sip.wrapinstance(parent,'TQWidget')\n"
#endif
" else:\n"
@@ -973,7 +973,7 @@ static TDECModule* return_instance( TQWidget *parent, const char *name ) {
if(!kcmFactory) {
return report_error ("***failed to find module factory\n");
}
-
+
// Call the factory function. Set up the args.
PyObject *pyParent = PyLong_FromVoidPtr(parent);
PyObject *pyName = PyString_FromString(MODULE_NAME);
@@ -995,7 +995,7 @@ static TDECModule* return_instance( TQWidget *parent, const char *name ) {
// Stop this from getting garbage collected.
Py_INCREF(PyTuple_GET_ITEM(pyTDECModuleTuple,0));
-
+
// convert the TDECModule PyObject to a real C++ TDECModule *.
isErr = 0;
pyTDECModule = PyTuple_GET_ITEM(pyTDECModuleTuple,1);
@@ -1004,7 +1004,7 @@ static TDECModule* return_instance( TQWidget *parent, const char *name ) {
return report_error ("***failed sip conversion to C++ pointer\n");
}
pyize->decref(pyTDECModuleTuple);
-
+
// PyTDE can't run the module without this - Pythonize
// grabs the lock at initialization and we have to give
// it back before exiting. At this point, we no longer need
@@ -1029,7 +1029,7 @@ extern "C" {
###########################################################################
class InstallKControlModule(Command):
description = "Install Kcontrol module files"
-
+
user_options = [
('install-dir=', 'd', "base directory for installing kcontrol module files"),
('install-cmd=', None, "Command to use to install the files"),
@@ -1040,7 +1040,7 @@ class InstallKControlModule(Command):
('skip-build', None, "skip the build steps"),
]
boolean_options = ['force', 'skip-build']
-
+
def initialize_options(self):
self.build_dir = None
self.install_dir = None
@@ -1055,7 +1055,7 @@ class InstallKControlModule(Command):
def finalize_options(self):
own_install_dir = self.install_dir is not None
own_xdg_apps_dir = self.xdg_apps_dir is not None
-
+
self.set_undefined_options('install',
('build_base', 'build_dir'),
('install_kcm', 'install_dir'),
@@ -1070,19 +1070,19 @@ class InstallKControlModule(Command):
self.install_dir = change_root(self.root,self.installdir)
if own_xdg_apps_dir and self.root is not None:
self.xdg_apps_dir = change_root(self.root,self.xdg_apps_dir)
-
+
def get_command_name(self):
return 'install_kcm'
-
+
def run(self):
if not self.skip_build:
self.run_command('build_kcm')
-
+
self.announce("Installing Kcontrol module files...")
for moduletuple in self.distribution.kcontrol_modules:
self.announce("Building KControl module from desktop file %s." % moduletuple[0])
-
+
# Read the desktop file
libraryname = None
cmodulecategory = None
@@ -1105,21 +1105,21 @@ class InstallKControlModule(Command):
fhandle.close()
except IOError:
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?)"
if cmodulecategory is None:
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))
desktopfile_dest = os.path.join(self.xdg_apps_dir,os.path.basename(desktopfilename))
self.copy_file(desktopfilename, desktopfile_dest)
-
+
stub_la_name = 'kcm_'+libraryname+'.la'
-
+
self.outfiles.extend(self.mkpath(self.install_dir))
-
+
# Install the library.
cmdlist = ['libtool']
cmdlist.append("--mode=install")
@@ -1132,9 +1132,9 @@ class InstallKControlModule(Command):
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)
-
+
self.announce("Done installing Kcontrol module files.")
-
+
def get_outputs(self):
return self.outfiles or []
@@ -1146,14 +1146,14 @@ class BuildDocbookHTML(Command):
description = "Build Docbook HTML documentation"
user_options = [('meinproc-exe=',None,"Path to the meinproc executable")]
-
+
def initialize_options(self):
self.html_prefix = None
self.meinproc_exe = None
-
+
def finalize_options(self):
self.set_undefined_options('build', ('meinproc_exe', 'meinproc_exe') )
-
+
def get_command_name(self):
return 'build_docbook'
@@ -1161,13 +1161,13 @@ class BuildDocbookHTML(Command):
for docbook_tuple in self.distribution.docbooks:
input_dir = docbook_tuple[0]
language_code = docbook_tuple[1]
-
+
self.announce("Building Docbook documentation from directory %s." % input_dir)
-
+
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
-
+
cwd = os.getcwd()
os.chdir(input_dir)
try:
@@ -1175,11 +1175,11 @@ class BuildDocbookHTML(Command):
spawn([self.meinproc_exe, 'index.docbook'])
finally:
os.chdir(cwd)
-
+
###########################################################################
class InstallDocbookHTML(Command):
description = "Install Docbook HTML files"
-
+
user_options = [
('install-dir=', 'd',"base directory for installing docbook HTML files"),
('root=', None, "install everything relative to this alternate root directory"),
@@ -1187,7 +1187,7 @@ class InstallDocbookHTML(Command):
('skip-build', None, "skip the build steps"),
]
boolean_options = ['force', 'skip-build']
-
+
def initialize_options(self):
self.install_dir = None
self.outfiles = []
@@ -1198,7 +1198,7 @@ class InstallDocbookHTML(Command):
def finalize_options(self):
own_install_dir = self.install_dir is not None
-
+
self.set_undefined_options('install',
('install_html', 'install_dir'),
('root', 'root'),
@@ -1208,33 +1208,33 @@ class InstallDocbookHTML(Command):
if own_install_dir and self.root is not None:
self.install_dir = change_root(self.root,self.installdir)
-
+
def get_command_name(self):
return 'install_html'
-
+
def run(self):
if not self.skip_build:
self.run_command('build_html')
-
+
self.announce("Installing HTML files...")
counter = 0
for docbook_tuple in self.distribution.docbooks:
input_dir = docbook_tuple[0]
language_code = docbook_tuple[1]
-
+
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
-
+
dest_path = os.path.join(self.install_dir, language_code, self.distribution.metadata.name)
self.outfiles.extend(self.mkpath(dest_path))
dest_file = os.path.join(dest_path,'index.cache.bz2')
-
+
self.copy_file(source_file, dest_file)
self.outfiles.append(dest_file)
counter += 1
-
+
# Also install any lose HTML files.
for source_file in glob.glob(os.path.join(input_dir,'*.html')):
htmlfile = os.path.basename(source_file)
@@ -1242,7 +1242,7 @@ class InstallDocbookHTML(Command):
self.copy_file(source_file, dest_file)
self.outfiles.append(dest_file)
counter += 1
-
+
if len(docbook_tuple)==3:
extra_files = docbook_tuple[2]
for file in extra_files:
@@ -1251,9 +1251,9 @@ class InstallDocbookHTML(Command):
self.copy_file(source_file, dest_file)
self.outfiles.append(dest_file)
counter += 1
-
+
self.announce("Done installing %i HTML files." % counter)
-
+
def get_outputs(self):
return self.outfiles or []
@@ -1272,36 +1272,36 @@ class UpdateI18NMessages(Command):
self.xgettext_exe = None
self.msgmerge_exe = None
self.kde_pot = None
-
+
def finalize_options(self):
if self.xgettext_exe is None:
install = self.get_finalized_command('install')
-
+
canidate_paths = []
if install.user_supplied_kde_prefix:
canidate_paths.append(os.path.join(install.kde_prefix,'bin'))
-
+
self.announce("Detecting xgettext...")
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'."
self.announce(" ...xgettext found at %s" % self.xgettext_exe)
-
+
if self.msgmerge_exe is None:
install = self.get_finalized_command('install')
-
+
canidate_paths = []
if install.user_supplied_kde_prefix:
canidate_paths.append(os.path.join(install.kde_prefix,'bin'))
-
+
self.announce("Detecting msgmerge...")
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'."
self.announce(" ...msgmerge found at %s" % self.msgmerge_exe)
-
+
if self.kde_pot is None:
self.announce("Detecting kde.pot...")
canidatepaths = []
@@ -1313,10 +1313,10 @@ class UpdateI18NMessages(Command):
canidatepaths.append('/opt/trinity/include')
canidatepaths.append('/opt/kde/include')
kde_pot_dir = FindFileInPaths('kde.pot',canidatepaths)
-
+
if kde_pot_dir is None:
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)
@@ -1325,24 +1325,24 @@ class UpdateI18NMessages(Command):
def run(self):
if self.distribution.i18n is None: return
-
+
self.announce("Extracting and merging i18n messages...")
po_dir = self.distribution.i18n[0]
-
+
# FIXME : .rc and .ui files
input_files = []
-
+
# Compile any UI files
for dir in self.distribution.i18n[1]:
for file in glob.glob(os.path.join(dir,'*.ui')):
qtuicompiler.UpdateUI(file,kde=True)
-
+
# Fetch all of the python files.
for dir in self.distribution.i18n[1]:
input_files.extend(glob.glob(os.path.join(dir,'*.py')))
-
+
target_pot = os.path.join(po_dir,self.distribution.metadata.name+".pot")
-
+
cmd = [self.xgettext_exe, '-o', target_pot, '-ki18n', '-ktr2i18n', \
'-kI18N_NOOP', '-ktranslate', '-kaliasLocale','-x',self.kde_pot]
cmd.extend(input_files)
@@ -1353,9 +1353,9 @@ class UpdateI18NMessages(Command):
cmd = [self.msgmerge_exe,'-q','-o',temp_po,po_file,target_pot]
spawn(cmd)
os.rename(temp_po,po_file)
-
+
self.announce("Finished with i18n messages.")
-
+
###########################################################################
class BuildI18NMessages(Command):
description = "Build i18n messages"
@@ -1364,7 +1364,7 @@ class BuildI18NMessages(Command):
def initialize_options(self):
self.msgfmt_exe = None
-
+
def finalize_options(self):
self.set_undefined_options('build', ('msgfmt_exe', 'msgfmt_exe'))
@@ -1373,10 +1373,10 @@ class BuildI18NMessages(Command):
def run(self):
if self.distribution.i18n is None: return
-
+
self.announce("Building i18n messages...")
po_dir = self.distribution.i18n[0]
-
+
i = 0
for po_file in [file for file in os.listdir(po_dir) if file.endswith('.po')]:
source = os.path.join(po_dir,po_file)
@@ -1396,9 +1396,9 @@ class InstallI18NMessages(Command):
('force', 'f', "force installation (overwrite existing files)"),
('skip-build', None, "skip the build steps"),
]
-
+
boolean_options = ['force', 'skip-build']
-
+
def initialize_options(self):
self.install_dir = None
self.outfiles = []
@@ -1409,7 +1409,7 @@ class InstallI18NMessages(Command):
def finalize_options(self):
own_install_dir = self.install_dir is not None
-
+
self.set_undefined_options('install',
('install_messages', 'install_dir'),
('root', 'root'),
@@ -1419,27 +1419,27 @@ class InstallI18NMessages(Command):
if own_install_dir and self.root is not None:
self.install_dir = change_root(self.root,self.installdir)
-
+
def get_command_name(self):
return 'install_messages'
-
+
def run(self):
if not self.skip_build:
self.run_command('build_messages')
-
+
self.announce("Installing i18n messages...")
po_dir = self.distribution.i18n[0]
-
+
counter = 0
for po_file in os.listdir(po_dir):
if po_file.endswith('.po'):
source_file = os.path.join(po_dir,po_file[:-3]) + '.gmo'
-
+
# Setup installation of the translation file.
dest_path = os.path.join(self.install_dir, po_file[:-3],'LC_MESSAGES')
self.outfiles.extend(self.mkpath(dest_path))
dest_file = os.path.join(dest_path, self.distribution.metadata.name+'.mo')
-
+
self.copy_file(source_file, dest_file)
self.outfiles.append(dest_file)
counter += 1
@@ -1451,7 +1451,7 @@ class InstallI18NMessages(Command):
def mkpath(self, name, mode=0777):
return dir_util.mkpath(name, mode, dry_run=self.dry_run)
-
+
###########################################################################
class BuildTdeioslave(Command):
description = "Build Tdeioslaves"
@@ -1471,7 +1471,7 @@ class BuildTdeioslave(Command):
('pyqt-dir=','/usr/lib/pyshared/python*','PyQt module directory'),
('pytde-dir=',None,'PyTDE module directory'),
('data-dir=',None,'installation directory for data (script) files')]
-
+
def initialize_options(self):
self.no_tdeioslave = 0
self.build_dir = None
@@ -1488,14 +1488,14 @@ class BuildTdeioslave(Command):
self.pyqt_dir = None
self.pytde_dir = None
self.data_dir = None
-
+
def finalize_options(self):
if self.no_tdeioslave==0:
self.set_undefined_options('install', ('build_base', 'build_dir'),('install_application_data','data_dir'))
-
+
install = self.get_finalized_command('install')
self.install_prefix = ask_kde_config('--prefix').strip()
-
+
# KDE inc dir: find it!
if self.kde_inc_dir is None:
canidatepaths = []
@@ -1511,19 +1511,19 @@ class BuildTdeioslave(Command):
if FindFileInPaths('tdeapplication.h',[self.kde_inc_dir]) is None:
raise SystemExit, "Failed to find KDE header files in: %s" % self.kde_inc_dir
self.announce("Using %s for KDE header files" % self.kde_inc_dir)
-
+
# KDE lib dir
if self.kde_lib_dir is None:
self.kde_lib_dir = os.path.join(self.install_prefix,"lib")
self.announce("Using %s for KDE library files" % self.kde_lib_dir)
-
+
# KDE tdeioslave lib dir
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
self.announce("Using %s for KDE Tdeioslave library files" % self.kde_tdeioslave_lib_dir)
-
+
# Qt inc dir
if self.qt_inc_dir is None:
canidatepaths = []
@@ -1549,7 +1549,7 @@ class BuildTdeioslave(Command):
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)
-
+
# Qt lib dir
if self.qt_lib_dir is None:
canidatepaths = []
@@ -1586,18 +1586,18 @@ class BuildTdeioslave(Command):
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)
-
+
# Python dir
if self.python_dir is None:
self.python_dir = os.path.split(sysconfig.get_config_var("LIBP"))[0]
self.announce("Using %s for the python directory" % self.python_dir)
-
+
# Python include dir.
if self.python_inc_dir is None:
# Find the Python include directory.
self.python_inc_dir = sysconfig.get_config_var("INCLUDEPY")
self.announce("Using %s for Python header files" % self.python_inc_dir)
-
+
# PyQt dir
if self.pyqt_dir is None:
self.pyqt_dir = m_pyqt_dir
@@ -1606,14 +1606,14 @@ class BuildTdeioslave(Command):
if (FindFileInPaths("libqtcmodule*",[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)
-
+
# 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
self.announce("Using %s for PyTDE modules" % self.pytde_dir)
-
+
# Sip dir
if self.sip_dir is None:
self.sip_dir = m_sip_dir
@@ -1622,7 +1622,7 @@ class BuildTdeioslave(Command):
if (FindFileInPaths("libsip*", [self.sip_dir]) is None) and (FindFileInPaths("sip*", [self.sip_dir]) is None):
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).
if self.clib is None:
canidatepaths = ["/usr/"+get_libdir_name(), "/usr/local/"+get_libdir_name() ]
@@ -1634,9 +1634,9 @@ 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, "kdedistutils.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")
@@ -1650,15 +1650,15 @@ class BuildTdeioslave(Command):
if self.no_tdeioslave:
self.announce("Skipping TDEIO Slaves")
return
-
+
if not os.path.isdir(self.build_dir):
os.mkdir(self.build_dir)
-
+
for moduletuple in self.distribution.tdeioslaves:
self.announce("Building TDEIO Slave from protocol file %s." % moduletuple[0])
-
+
protocolfilename = moduletuple[0]
-
+
# Read the protocol file
libraryname = None
try:
@@ -1673,25 +1673,25 @@ class BuildTdeioslave(Command):
fhandle.close()
except IOError:
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?)"
-
+
modulename = os.path.basename(moduletuple[1])
if modulename.endswith('.py'):
modulename = modulename[:-3]
-
+
stub_cpp_name = libraryname+'.cpp'
stub_so_name = libraryname+'.so'
stub_la_name = libraryname+'.la'
python_version = '%i.%i' % (sys.version_info[0],sys.version_info[1])
-
+
# Build the 'stub' code.
cppcode = self.cpptemplate % {"moduledir": self.data_dir,
"modulename": modulename,
"python_version": python_version}
-
+
# Put it on disk.
cppfile = os.path.join(os.path.dirname(moduletuple[0]),stub_cpp_name)
try:
@@ -1700,14 +1700,14 @@ class BuildTdeioslave(Command):
fhandle.close()
except IOError:
raise SystemExit, "Could not write the C++ stub: %s" % cppfile
-
+
# Compile the stub library.
cmdlist = ['libtool']
# Couldn't get it to pass without this ...
cmdlist.append("--mode=compile")
cmdlist.append("--tag=CXX")
-
+
# Find the compiler flags and options
# CXX is empty on some Systems, let's do it 'the hard way'.
# FIXME :: get CXX from make.conf for Gentoo.
@@ -1717,11 +1717,11 @@ class BuildTdeioslave(Command):
cmdlist.extend(['g++', '-pthread'])
#cmdlist.extend(sysconfig.get_config_var("CXX").split())
-
+
# cc_flags
cmdlist.append("-c")
cmdlist.append("-g")
-
+
# The 4 is randomly chosen!
# FIXME :: get CFLAGS from make.conf for Gentoo.
if len(sysconfig.get_config_var("CFLAGS").split()) >=4:
@@ -1737,7 +1737,7 @@ class BuildTdeioslave(Command):
else:
# Still no CFLAGS found, use these ...
cmdlist.extend(['-fno-strict-aliasing', '-DNDEBUG', '-g', '-O3', '-Wall', '-Wstrict-prototypes'])
-
+
#sysconfig.get_config_var("CFLAGS").split()
# includes
cmdlist.append("-I" + sysconfig.get_config_var("INCLUDEDIR"))
@@ -1757,12 +1757,12 @@ class BuildTdeioslave(Command):
cmdlist.append(outputfile)
spawn(cmdlist) # Execute!!!
print
-
+
# Link the resulting object file to create a shared library.
cmdlist = ['libtool']
cmdlist.append("--mode=link")
cmdlist.append("--tag=LD")
-
+
# Grab the linker command name
cmdlist.append(sysconfig.get_config_var("LDSHARED").split()[0])
# link_flags
@@ -1778,20 +1778,20 @@ class BuildTdeioslave(Command):
linklist = []
linklist.append("-lpython%s" % python_version)
linklist.extend(sysconfig.get_config_var("LIBS").split())
-
+
# FIXME I doubt half of these libraries need to be here.
linklist.append(self.sip_dir+"/sip.so")
# PyQt 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")
# # PyQt libs
# linklist.append("-L"+self.pyqt_dir); linklist.append("-lqtcmodule")
# # PyTDE libs
# linklist.append("-L"+self.pytde_dir); linklist.append("-ltdecorecmodule"); linklist.append("-ltdeuicmodule")
-
+
linklist.append("-L"+self.kde_lib_dir); linklist.append("-L/opt/trinity/lib"); linklist.append("-ltdecore"); linklist.append("-lpythonize")
linklist.append("-L"+self.qt_lib_dir); linklist.append("-lqt-mt")
linklist.append("-lm")
@@ -1808,7 +1808,7 @@ class BuildTdeioslave(Command):
cmdlist.extend(linklist)
spawn(cmdlist) # Execute!!
print
-
+
cpptemplate = r"""
/*
* Launch Control Centre modules written in Python using an embedded Python
@@ -1830,12 +1830,12 @@ FILE *d = NULL;
PyObject* call_function(PyObject *callable, PyObject *args) {
PyObject *result, *pArgs;
-
+
if (callable == NULL) {
printf(MODULE_NAME " tdeioslave error: callable == NULL in call_function\n");
return NULL;
}
-
+
if (PyCallable_Check(callable)) {
if(args == NULL) {
pArgs = PyTuple_New(0);
@@ -1843,20 +1843,20 @@ PyObject* call_function(PyObject *callable, PyObject *args) {
pArgs = args;
}
result = PyObject_CallObject(callable, pArgs);
-
+
/* If the arguments were created is this function then decrease
their reference count. */
if(args == NULL) {
Py_XDECREF(pArgs);
/* pDict and pFunc are borrowed and must not be Py_DECREF-ed */
}
-
+
if(result == NULL) {
PyErr_Print();
PyErr_Clear();
}
}
-
+
return result;
}
@@ -1864,54 +1864,54 @@ extern "C" {
int kdemain( int argc, char **argv) {
PyObject *pModule, *pName, *pDict;
TDEInstance slave(MODULE_NAME);
-
+
Py_SetProgramName(argv[0]);
Py_Initialize();
//PyEval_InitThreads();
PySys_SetArgv(1, argv);
-
+
PyRun_SimpleString("import sys\n");
PyRun_SimpleString("sys.path.append('"MODULE_DIR"')\n");
-
+
pName = PyString_FromString(modname);
pModule = PyImport_Import(pName);
-
+
Py_XDECREF(pName);
-
+
if(pModule == NULL) {
printf(MODULE_NAME " tdeioslave error: pModule == NULL\n");
return 1;
} else {
PyObject *pClass, *pMethod, *pArgs, *pArg1, *pArg2, *pInstance;
int i;
-
+
pDict = PyModule_GetDict(pModule);
/* pDict is a borrowed reference */
-
+
pClass = PyDict_GetItemString(pDict, FACTORY);
-
+
if(pClass == NULL) {
printf(MODULE_NAME " tdeioslave error: pClass == NULL\n");
return 1;
} else {
pArgs = PyTuple_New(2);
-
+
pArg1 = PyString_FromString(argv[2]);
pArg2 = PyString_FromString(argv[3]);
-
+
PyTuple_SetItem(pArgs, 0, pArg1);
PyTuple_SetItem(pArgs, 1, pArg2);
-
+
call_function(pClass, pArgs);
-
+
/* Some time later... */
Py_XDECREF(pClass);
Py_XDECREF(pArgs);
}
-
+
Py_XDECREF(pModule);
}
-
+
Py_Finalize();
return 0;
}
@@ -1920,7 +1920,7 @@ extern "C" {
###########################################################################
class InstallTdeioslave(Command):
description = "Install Tdeioslave files"
-
+
user_options = [
('install-dir=', 'd', "base directory for installing tdeioslave module files"),
('install-cmd=', None, "Command to use to install the files"),
@@ -1931,7 +1931,7 @@ class InstallTdeioslave(Command):
('skip-build', None, "skip the build steps"),
]
boolean_options = ['force', 'skip-build']
-
+
def initialize_options(self):
self.build_dir = None
self.install_dir = None
@@ -1946,7 +1946,7 @@ class InstallTdeioslave(Command):
def finalize_options(self):
own_install_dir = self.install_dir is not None
own_install_protocol_dir = self.install_protocol_dir is not None
-
+
self.set_undefined_options('install',
('build_base', 'build_dir'),
('install_tdeioslave', 'install_dir'),
@@ -1959,24 +1959,24 @@ class InstallTdeioslave(Command):
if own_install_dir and self.root is not None:
self.install_dir = change_root(self.root,self.installdir)
-
+
if own_install_protocol_dir and self.root is not None:
self.install_protocol_dir = change_root(self.root,self.install_protocol_dir)
-
+
def get_command_name(self):
return 'install_tdeioslave'
-
+
def run(self):
if not self.skip_build:
self.run_command('build_tdeioslave')
-
+
self.announce("Installing Tdeioslave files...")
for moduletuple in self.distribution.tdeioslaves:
self.announce("Building Tdeioslave module from protocol file %s." % moduletuple[0])
-
+
protocolfilename = moduletuple[0]
-
+
# Read the protocol file
libraryname = None
try:
@@ -1991,18 +1991,18 @@ class InstallTdeioslave(Command):
fhandle.close()
except IOError:
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?)"
-
+
self.outfiles.extend(self.mkpath(self.install_protocol_dir))
protocolfile_dest = os.path.join(self.install_protocol_dir,os.path.basename(protocolfilename))
self.copy_file(protocolfilename, protocolfile_dest)
-
+
stub_la_name = libraryname+'.la'
-
+
self.outfiles.extend(self.mkpath(self.install_dir))
-
+
# Install the library.
cmdlist = ['libtool']
cmdlist.append("--mode=install")
@@ -2015,27 +2015,27 @@ class InstallTdeioslave(Command):
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)
-
+
self.announce("Done installing Tdeioslave files.")
-
+
def get_outputs(self):
return self.outfiles or []
def mkpath(self, name, mode=0777):
return dir_util.mkpath(name, mode, dry_run=self.dry_run)
-
+
###########################################################################
class CheckPyQt(Command):
description = "Checks for the presence of a working PyQt installation"
user_options = []
-
+
def initialize_options(self):
pass
-
+
def finalize_options(self):
self.min_qt_version = self.distribution.min_qt_version
-
+
def run(self):
if self.min_qt_version!=None:
qtver,kdever = get_qt_kde_versions()
@@ -2056,13 +2056,13 @@ class CheckPyTDE(Command):
description = "Checks for the presence of a working PyTDE installation"
user_options = []
-
+
def initialize_options(self):
pass
-
+
def finalize_options(self):
self.min_kde_version = self.distribution.min_kde_version
-
+
def run(self):
if self.min_kde_version!=None:
qtver,kdever = get_qt_kde_versions()
@@ -2070,8 +2070,8 @@ class CheckPyTDE(Command):
raise SystemExit, "Your KDE 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...")
-
- # Try to import modules one by one.
+
+ # Try to import modules one by one.
for k_module in ('dcop', 'tdecore', 'tdeui', 'tdeio', 'tdefile', 'tdeparts', 'tdehtml', 'tdespell'):
self.announce(k_module)
try:
@@ -2081,21 +2081,21 @@ class CheckPyTDE(Command):
"Couldn't import KDE! Please make sure that PyTDE is installed and working.\n" + \
"PyTDE is available here: http://www.trinitydesktop.org"
self.announce(" ...PyTDE is working")
-
+
def get_outputs(self): return []
-
+
###########################################################################
def FindFileInPaths2(globpattern,canidatepaths):
if canidatepaths is None or len(canidatepaths)==0:
return (None,None)
-
+
# Look for the globpattern on the path.
for path in canidatepaths:
if path!=None:
files = glob.glob(os.path.join(path, globpattern))
if len(files)!=0:
return (path,os.path.basename(files[0]))
-
+
# Continue searching with a breadth first search.
dirs = []
for path in canidatepaths:
@@ -2112,21 +2112,21 @@ def FindFileInPaths2(globpattern,canidatepaths):
def FindFileInPaths(globpattern,canidatepaths):
x,y = FindFileInPaths2(globpattern,canidatepaths)
return x
-
+
###########################################################################
# FIXME replace this with spawn.find_executable().
def FindExeOnPath(exe_name,high_prio_dirs=None,low_prio_dirs=None):
candiate_paths = []
-
+
if high_prio_dirs is not None:
candiate_paths.extend(high_prio_dirs)
-
+
path_var = os.getenv("PATH")
candiate_paths.extend(path_var.split(':'))
-
+
if low_prio_dirs is not None:
candiate_paths.extend(low_prio_dirs)
-
+
for dir in candiate_paths:
if dir is not None:
candiate = os.path.join(dir,exe_name)
@@ -2134,7 +2134,7 @@ def FindExeOnPath(exe_name,high_prio_dirs=None,low_prio_dirs=None):
if os.access(candiate,os.X_OK):
return candiate
return None
-
+
###########################################################################
def ask_kde_config(question):
@@ -2142,7 +2142,7 @@ def ask_kde_config(question):
kdeconfig = find_executable("tde-config", os.environ['PATH'] + os.pathsep + \
os.pathsep.join(['/bin','/usr/bin','/opt/trinity/bin','/opt/kde/bin','/usr/local/bin']))
if kdeconfig!=None:
- # Ask the tde-config program for the
+ # Ask the tde-config program for the
fhandle = os.popen(kdeconfig+' ' + question,'r')
result = fhandle.read()
fhandle.close()
@@ -2241,7 +2241,7 @@ def compile_qtdesigner(ui_files,
prefix=None, base_dir=None,
verbose=1, dry_run=0):
"""Compile a collection of QT Designer UI files to .py
-
+
If 'dry_run' is true, doesn't actually do anything that would
affect the filesystem.
"""
@@ -2255,7 +2255,7 @@ def compile_qtdesigner(ui_files,
# dfile - purported source filename (same as 'file' by default)
if base_dir:
file = os.path.join(base_dir ,file)
-
+
pyfile = file[:-3] + '.py'
uifile = file
@@ -2264,7 +2264,7 @@ def compile_qtdesigner(ui_files,
log.info("compiling Qt-Designer UI %s to %s", file, pyfile_base)
if not dry_run:
qtuicompiler.CompileUI(uifile, pyfile)
- generated_files.append(pyfile)
+ generated_files.append(pyfile)
else:
log.debug("skipping Qt-Designer compilation of %s to %s",
file, pyfile_base)