Bug 152573

Summary: move pywxrc back to python-wxGTK sub-package
Product: [openSUSE] SUSE Linux 10.1 Reporter: Andreas Hanke <andreas.hanke>
Component: GNOMEAssignee: E-mail List <gnome-bugs>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Minor    
Priority: P5 - None    
Version: Beta 4   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Andreas Hanke 2006-02-21 19:30:33 UTC
With the fix for bug 143258, pywxrc was moved from python-wxGTK to wxGTK-devel. Reason: Instead of adding it automatically to the python-wxGTK file list, it is now added manually, but this time to wxGTK-devel.

Problem 1:

Strictly speaking, wxGTK-devel would have to depend on python and python-wxGTK because if pywxrc is executed without python-wxGTK installed, it fails:

$ pywxrc
Traceback (most recent call last):
  File "/usr/bin/pywxrc", line 3, in ?
    from wx.tools.pywxrc import main
ImportError: No module named wx.tools.pywxrc

Problem 2:

If a wxPython application BuildRequires pywxrc, it would currently have to BuildRequire wxGTK-devel because of pywxrc even though it does probably not need the C++ headers.

Therefore I suggest moving pywxrc back to python-wxGTK so that wxrc from wxGTK-devel is used for C++ applications and pywxrc is used for wxPython applications:

--- wxGTK.spec.orig
+++ wxGTK.spec
@@ -285,7 +285,6 @@
 
 %files devel -f FILELIST.devel
 %defattr (755, root, root, 755)
-%{_bindir}/pywxrc
 %{_bindir}/wxrc
 %{_bindir}/wxrc-2.6
 %{_bindir}/*-config*
@@ -305,6 +304,7 @@
 %files -n python-wxGTK -f FILELIST.python
 %defattr(-, root, root)
 %doc wxPython/docs/*.txt wxPython/docs/*.html wxPython/docs/screenshots wxPython/licence
+%{_bindir}/pywxrc
 %dir %{_includedir}/wx-2.6/wx
 %{_includedir}/wx-2.6/wx/wxPython
 %{py_sitedir}/*
Comment 1 Stanislav Brabec 2006-02-22 12:49:17 UTC
Can pywxrc work correctly without wxGTK-devel?

If yes, I agree wiith your patch, if not, I would prefer adding "Requires: python-wxGTK" to wxGTK-devel instead of moving pywxrc. (This is the way many packages are splitted already - additional package required for development is not a much pain.)
Comment 2 Andreas Hanke 2006-02-22 18:01:01 UTC
> Can pywxrc work correctly without wxGTK-devel?

Yes, pywxrc usage doesn't require the C++ headers to be present.

Example: http://wiki.wxpython.org/index.cgi/UsingXmlResources

- save section 4 of this page as "calc.py(w)"

- save section 5 of this page as "calc.xrc"

- use pywxrc to extract strings for gettext:

$ pywxrc -g calc.xrc
_("Simple calculator")
_("First arg:")
_("Second arg:")
_("Result:")
_("Operations")
_("&Add")
_("Add second arg to the first arg.")
_("&Substract")
_("Substract second arg from the first arg.")
_("&Multiply")
_("Multiply first arg by second arg")
_("&Divide")
_("Divide first arg by second arg.")

It works correctly without wxGTK-devel installed.

The same can also be used to generate Python and C++ sources:

$ pywxrc -p calc.xrc (produces "resource.py")

$ pywxrc -c calc.xrc (produces "resource.cpp")

The only potential problem is that "resource.cpp" #include's headers from wxGTK-devel, but I doubt that this justifies a dependency on wxGTK-devel because wxGTK-devel is not needed to create "resource.cpp", it's only needed to compile it, and you can do other things (with the "-g" and "-p" switches) that are completely unrelated to the C++ headers.
Comment 3 Stanislav Brabec 2006-02-23 11:46:36 UTC
Thanks for explanation. pywxrc moved to python-wxGTK.