[Skencil-devel] Skencil build issues in modern environment

Adam Williamson awilliamson at mandriva.com
Thu May 3 02:57:30 CEST 2007


Hi!

I've been working through old packages in Mandriva updating them and I
came to Skencil, which has now been kicking my ass for a couple of
days :)

I can't get it to work in our current development environment:

Tcl/Tk 8.5a5
X.org 7.2
Python 2.5
python-imaging 1.1.16

I'm using current SVN skencil-0.6 branch.

it will build and run but crashes immediately:

[adamw at lenovo ~]$ skencil 
shared memory images supported
Could not load font '-misc-fixed-medium-*-*-*-11-*-*-*-*-*-iso8859-1'
for ruler. using defaults.
Traceback (most recent call last):
  File "/usr/bin/skencil", line 34, in <module>
    Sketch.main.main()
  File "/usr/lib/skencil-0.6.17/Sketch/Base/main.py", line 148, in main
    run_script = options.run_script)
  File "/usr/lib/skencil-0.6.17/Sketch/UI/skapp.py", line 183, in
__init__
    self.build_window()
  File "/usr/lib/skencil-0.6.17/Sketch/UI/skapp.py", line 223, in
build_window
    self.run_script)
  File "/usr/lib/skencil-0.6.17/Sketch/UI/mainwindow.py", line 97, in
__init__
    self.build_window()
  File "/usr/lib/skencil-0.6.17/Sketch/UI/mainwindow.py", line 592, in
build_window
    hrule = ruler.Ruler(root, orient = ruler.HORIZONTAL)
  File "/usr/lib/skencil-0.6.17/Sketch/UI/ruler.py", line 68, in
__init__
    font = self.tkwin.LoadQueryFont('fixed')
AttributeError: Ruler instance has no attribute 'tkwin'

I believe this to be an incompatibility with Tcl/Tk 8.5, as the same
package does build and run on Mandriva Linux 2007, which uses Tcl/Tk
8.4. Also uses python 2.4, X.org 7.1 and python-imaging 1.1.14, but I
feel the problem is with Tcl/Tk.

The Skencil build process also seems to be...

um...

antiquated :)

it really does not build at all on x86-64, it just isn't set up for it.
Doesn't understand the concept of /usr/lib64 or the possibility that
some stuff (e.g. the Python setup file) might live there.

It's still set up for old-fashioned monolithic X only: it expects
everything to be in /usr/X11R6.

It doesn't know Tcl/Tk 8.5 even exists :)

It installs everything to /usr/lib/skencil-{version}. This is not, I
think, in line with modern Python practice, where all the .py files are
supposed to go to /{libdir}/python{version}/site-packages/skencil ,
where {libdir} is /usr/lib or /usr/lib64.

I gave up on fixing the last issue, but I fixed all the others in my
current spec. It includes:

1. A patch to change the default FontPath in config.py:

-font_path = ['/usr/X11R6/lib/X11/fonts/Type1',
-	     '/usr/share/ghostscript/fonts',
-	     '/usr/lib/ghostscript/fonts']
+font_path = ['/usr/share/fonts/default/Type1',
+	     '/usr/share/fonts/default/ghostscript',
+	     '/usr/share/fonts/misc']

(the patch also makes a lot of other changes to the default font
definitions, but that may be Mandriva-specific, the changes are as
discussed on the Skencil download page - "Mandriva ships Skencil
packages, at least you can get them from their cooker and the mirrors.
At time of writing (May 2006) Mandriva's cooker has a 0.6.17 Skencil
package. Some Mandriva versions had missconfigured fonts. If you have
this problem there is a solution outlined in Mandriva Issue#20899.")

2. A patch that clues setup.py in to the existence of tcl 8.5:

-    for version in ["8.4", "8.3", "8.2", "8.1", "8.0"]:
+    for version in ["8.5", "8.4", "8.3", "8.2", "8.1", "8.0"]:

3. The following commands to respect X.org 7.x file locations:

perl -pi -e 's,/usr/X11R6,/usr,g' Pax/Setup.in
perl -pi -e 's,/usr/X11R6,/usr,g' setup.py
perl -pi -e 's,/usr/X11R6,/usr,g' Sketch/Modules/Setup.in

4. The following commands to clue Skencil in to the existence
of /usr/lib64 on x86-64 arch. %_libdir is a standard rpm macro that
expands to /usr/lib or /usr/lib64 as appropriate. Unfortunately I
couldn't use it for the substitions in the "%ifarch x86_64" bit because
they're a bit too indirect. Messy, I know. If you're wondering why just
one of the commands uses sed and the others all use perl it's because I
couldn't figure out how to escape a ' properly with perl's substitution
stuff! (the command replaces 'lib' with 'lib64')

perl -pi -e 's,\$\(exec_prefix\)/lib,%_libdir,g' Pax/Makefile.pre.in
perl -pi -e 's,\$\(exec_installdir\)/lib,%_libdir,g' Pax/Makefile.pre.in
perl -pi -e 's,\$\(exec_prefix\)/lib,%_libdir,g' Filter/Makefile.pre.in
perl -pi -e 's,\$\(exec_installdir\)/lib,%_libdir,g'
Filter/Makefile.pre.in
perl -pi -e 's,\$\(exec_prefix\)/lib,%_libdir,g'
Sketch/Modules/Makefile.pre.in
perl -pi -e 's,\$\(exec_installdir\)/lib,%_libdir,g'
Sketch/Modules/Makefile.pre.in
perl -pi -e 's,/usr/lib,%_libdir,g' Pax/Setup.in
perl -pi -e 's,/usr/lib,%_libdir,g' setup.py
%ifarch x86_64
perl -pi -e 's,lib/python,lib64/python,g' setup.py
sed -i s/\'lib\'/\'lib64\'/ setup.py
%endif

5. The parameter --python-setup=%py_platlibdir/config/Setup
to ./setup.py configure. %py_platlibdir is a Mandriva RPM macro that
expands to /usr/lib/python{version} or /usr/lib64/python{version} as
appropriate. Without this, the configure process always looks
for /usr/lib/python{version}/config/Setup, even on x86-64.

Note that I haven't yet tested the x86-64 build, not having an x86-64
machine handy to test on (I build via ssh on our build cluster's x86-64
machine, but I can't run X apps on it). I have tested the i586 build on
Mandriva 2007 and it appears to work OK.

Hope this is interesting to all. If anyone wants to help on the Tcl/Tk 
8.5 / font issue, that would be greatly welcomed :)
-- 
adamw



More information about the Skencil-devel mailing list