Re: BioPython: Some Python modules not found in tests at package build time

2014-04-29 Thread Andreas Tille
Hi,

On Mon, Apr 28, 2014 at 03:39:59PM +0200, Jakub Wilk wrote:
 ITYM s/maintains/is in Uploaders of/. It makes a big difference
 here...
 
 Does this mean that not any member of the team could upload a
 fixed package?
 
 I don't know that. What I know is that there were no commits to the
 package's repository by the maintainers since 2006. And changes by
 other team members made to the repository weren't integrated in
 package either.

I remember some flame wars about the fact that people doing a lot of
important work fail to share a part of their work and I see no point
in heating these flames again. :-(
 
 Well, I have no idea what porting really means.
 
 python-imaging's description more or less says what you have to change:
 “PIL used to provide a PIL.pth file which allowed you to `import
 Image` but this is deprecated.  Use `from PIL import Image` now, or
 install this compatibility package to temporarily get the old
 behavior back.”
 
 If there might be a simple patch that would be OK.  Otherwise I
 can only hope for upstream.
 
 That attached (untested) patch should do the trick.

Many thanks, it is included now.

Kind regards

Andreas.

-- 
http://fam-tille.de


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140429081902.gb20...@an3as.eu



Re: BioPython: Some Python modules not found in tests at package build time

2014-04-28 Thread Andreas Tille
Hi,

On Sat, Apr 26, 2014 at 09:12:45PM +0200, Jakub Wilk wrote:
 * Andreas Tille andr...@an3as.eu, 2014-04-25, 16:08:
 [Debian Python Modules Team
 python-modules-t...@lists.alioth.debian.org in CC since it
 maintains python-reportlab]
 
 ITYM s/maintains/is in Uploaders of/. It makes a big difference here...

Does this mean that not any member of the team could upload a fixed
package?  That would be strange regarding my experience with packaging
teams.

 Well, this was rather me forgetting a python-imaging dependency
 - I (wrongly) assumed that python-pil would be sufficient.
 
 Note that python-imaging is only a compatibility package. It would
 be better to port biopython to the new PIL API.

Well, I have no idea what porting really means.  If there might be a
simple patch that would be OK.  Otherwise I can only hope for upstream.
 
 Unfortunately the result remained the same.  I somehow came to the
 conclusion that the problem is caused by a broken reportlab
 package
 
 I came to the same conclusion. I've attached what seems to be a
 minimal test-case:
 ...
 If I understand correctly, reportlab is trying to use non-free Adobe
 PostScript fonts, which (unsurprisingly) doesn't work on Debian
 systems. It should use the substitutes from the gsfonts package
 instead.

As I just reported to #745985 your patch works nicely.  Many thanks for
it.  It would be great if there would be an upload of this fix in a
short timeframe.

Many thanks

   Andreas.

-- 
http://fam-tille.de


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/2014042841.gk8...@an3as.eu



Re: BioPython: Some Python modules not found in tests at package build time

2014-04-28 Thread Jakub Wilk

* Andreas Tille andr...@an3as.eu, 2014-04-28, 13:11:
[Debian Python Modules Team 
python-modules-t...@lists.alioth.debian.org in CC since it 
maintains python-reportlab]


ITYM s/maintains/is in Uploaders of/. It makes a big difference 
here...


Does this mean that not any member of the team could upload a fixed 
package?


I don't know that. What I know is that there were no commits to the 
package's repository by the maintainers since 2006. And changes by other 
team members made to the repository weren't integrated in package 
either.


Well, this was rather me forgetting a python-imaging dependency - I 
(wrongly) assumed that python-pil would be sufficient.


Note that python-imaging is only a compatibility package. It would be 
better to port biopython to the new PIL API.


Well, I have no idea what porting really means.


python-imaging's description more or less says what you have to change:
“PIL used to provide a PIL.pth file which allowed you to `import Image` 
but this is deprecated.  Use `from PIL import Image` now, or install 
this compatibility package to temporarily get the old behavior back.”


If there might be a simple patch that would be OK.  Otherwise I can 
only hope for upstream.


That attached (untested) patch should do the trick.

--
Jakub Wilk
diff --git a/Tests/test_GenomeDiagram.py b/Tests/test_GenomeDiagram.py
--- a/Tests/test_GenomeDiagram.py
+++ b/Tests/test_GenomeDiagram.py
@@ -27,7 +27,7 @@
 Install reportlab if you want to use Bio.Graphics.)
 
 try:
-import Image
+from PIL import Image
 from reportlab.graphics import renderPM
 except ImportError:
 #This is an optional part of ReportLab, so may not be installed.
diff --git a/Tests/test_GraphicsBitmaps.py b/Tests/test_GraphicsBitmaps.py
--- a/Tests/test_GraphicsBitmaps.py
+++ b/Tests/test_GraphicsBitmaps.py
@@ -35,7 +35,7 @@
 bitmaps with Bio.Graphics.)
 try:
 # Skip the test if PIL is not installed
-import Image as i
+from PIL import Image as i
 del i
 except:
 raise MissingPythonDependencyError(


Re: BioPython: Some Python modules not found in tests at package build time

2014-04-26 Thread Jakub Wilk

* Andreas Tille andr...@an3as.eu, 2014-04-25, 16:08:
[Debian Python Modules Team 
python-modules-t...@lists.alioth.debian.org in CC since it maintains 
python-reportlab]


ITYM s/maintains/is in Uploaders of/. It makes a big difference here...


test_GraphicsBitmaps ... Warn: Can't find .pfb for face 'Times-Roman'
skipping. Check the fonts needed by ReportLab if you want bitmaps from 
Bio.Graphics
Can't setFont(Times-Roman) missing the T1 files?
Originally type 'exceptions.TypeError': makeT1Font() argument 2 must be 
string, not None


Well, this was rather me forgetting a python-imaging dependency - I 
(wrongly) assumed that python-pil would be sufficient.


Note that python-imaging is only a compatibility package. It would be 
better to port biopython to the new PIL API.


So any idea how to get .pfb for face 'Times-Roman' found by 
reportlab

[…]
Unfortunately the result remained the same.  I somehow came to the 
conclusion that the problem is caused by a broken reportlab package


I came to the same conclusion. I've attached what seems to be a minimal 
test-case:


$ python test.py
Warn: Can't find .pfb for face 'Times-Roman'
Traceback (most recent call last):
 File test.py, line 6, in module
   renderPM.drawToFile(d, 'test.png', 'PNG')
 File /usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py, line 
655, in drawToFile
   c = drawToPMCanvas(d, dpi=dpi, bg=bg, configPIL=configPIL, 
showBoundary=showBoundary)
 File /usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py, line 
641, in drawToPMCanvas
   draw(d, c, 0, 0, showBoundary=showBoundary)
 File /usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py, line 
50, in draw
   R.draw(renderScaledDrawing(drawing), canvas, x, y, showBoundary=showBoundary)
 File /usr/lib/python2.7/dist-packages/reportlab/graphics/renderbase.py, line 
198, in draw
   self.initState(x,y)  #this is the push()
 File /usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py, line 
99, in initState
   self.applyState()
 File /usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py, line 
93, in applyState
   self._canvas.setFont(s['fontName'], s['fontSize'])
 File /usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py, line 
374, in setFont
   _setFont(self._gs,fontName,fontSize)
 File /usr/lib/python2.7/dist-packages/reportlab/graphics/renderPM.py, line 
227, in _setFont
   raise RenderPMError(Can't setFont(%s) missing the T1 files?\nOriginally %s: 
%s % (fontName,s1,s2))
reportlab.graphics.renderPM.RenderPMError: Can't setFont(Times-Roman) missing 
the T1 files?
Originally type 'exceptions.TypeError': makeT1Font() argument 2 must be 
string, not None


If I understand correctly, reportlab is trying to use non-free Adobe 
PostScript fonts, which (unsurprisingly) doesn't work on Debian systems. 
It should use the substitutes from the gsfonts package instead.


--
Jakub Wilk
from reportlab.graphics.shapes import Drawing
from reportlab.graphics import renderPM

d = Drawing(100, 100)
renderPM.drawToFile(d, 'test.png', 'PNG')


Re: BioPython: Some Python modules not found in tests at package build time

2014-04-26 Thread Jakub Wilk

* Jakub Wilk jw...@debian.org, 2014-04-26, 21:12:

reportlab.graphics.renderPM.RenderPMError: Can't setFont(Times-Roman) missing 
the T1 files?
Originally type 'exceptions.TypeError': makeT1Font() argument 2 must be 
string, not None


Filed as #745985. Please let me know if the patch I made fixes all the 
reportlab problems for you.


--
Jakub Wilk


--
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140426215312.ga4...@jwilk.net



Re: BioPython: Some Python modules not found in tests at package build time

2014-04-25 Thread Andreas Tille
Hi,

On Fri, Apr 25, 2014 at 03:05:42PM +0200, Andreas Tille wrote:
 Hi,
  
 as I wrote in my last mail I have started anyother try to finalise
 BioPython which is prepared at
  
Vcs-Svn: 
 svn://anonscm.debian.org/debian-med/trunk/packages/python-biopython/trunk/
 
 I hope the final problem with the tests is that I get output like
 
 test_GraphicsBitmaps ... skipping. Install PIL (Python Imaging Library) if 
 you want to create bitmaps with Bio.Graphics.
 
 despite the required Python modules are installed.  Interestingly enough
 if I manually run the test suite I get a different warning message for
 test_GraphicsBitmaps:
 
 test_GraphicsBitmaps ... Warn: Can't find .pfb for face 'Times-Roman'
 skipping. Check the fonts needed by ReportLab if you want bitmaps from 
 Bio.Graphics
 Can't setFont(Times-Roman) missing the T1 files?
 Originally type 'exceptions.TypeError': makeT1Font() argument 2 must be 
 string, not None
 
 
 My conclusion is that when not running the build (here it is not relevant
 whether I'm doing debuild or pdebuild!) PIL is not found but in case I
 run the test suite manually afterwards it is found an some other problem
 occures (hints how to get the .pfb files are for sure welcome as well).

Well, this was rather me forgetting a python-imaging dependency - I
(wrongly) assumed that python-pil would be sufficient.  So any idea
how to get .pfb for face 'Times-Roman' found by reportlab

Kind regards

  Andreas.

-- 
http://fam-tille.de


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140425133221.gg13...@an3as.eu



Re: BioPython: Some Python modules not found in tests at package build time

2014-04-25 Thread Andreas Tille
[Debian Python Modules Team python-modules-t...@lists.alioth.debian.org in CC
 since it maintains python-reportlab]

Hi again,

On Fri, Apr 25, 2014 at 03:32:21PM +0200, Andreas Tille wrote:
  
  test_GraphicsBitmaps ... Warn: Can't find .pfb for face 'Times-Roman'
  skipping. Check the fonts needed by ReportLab if you want bitmaps from 
  Bio.Graphics
  Can't setFont(Times-Roman) missing the T1 files?
  Originally type 'exceptions.TypeError': makeT1Font() argument 2 must be 
  string, not None
 
 Well, this was rather me forgetting a python-imaging dependency - I
 (wrongly) assumed that python-pil would be sufficient.  So any idea
 how to get .pfb for face 'Times-Roman' found by reportlab

Some websearch leaded me to #174639 and thus I applied the following
patch to python-reportlab:


Author: Andreas Tille ti...@debian.org
Last-Update: Fri, 25 Apr 2014 16:02:07 +0200
Description: Fix TTFSearchpath (see #174639)

--- a/src/reportlab/rl_settings.py
+++ b/src/reportlab/rl_settings.py
@@ -122,6 +122,7 @@ T1SearchPath =  (
.
 # places to look for TT Font information
 TTFSearchPath = (
+'/usr/share/fonts/truetype/',   # Here are Debian's TTF fonts 
kept
 'c:/winnt/fonts',
 'c:/windows/fonts',
 '/usr/lib/X11/fonts/TrueType/',



Unfortunately the result remained the same.  I somehow came to the
conclusion that the problem is caused by a broken reportlab package but
it seems my patch did not solved the issue.  Any better idea?  I do
not really want to reopen #174639 / file a new bug before I'm really
sure that this is the cause of the problem.

Kind regards

Andreas.

-- 
http://fam-tille.de


-- 
To UNSUBSCRIBE, email to debian-python-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: https://lists.debian.org/20140425140841.gh13...@an3as.eu