Article View: news.software.nntp
Article #87314Re: PyClean installation
From: Steve Crook
Date: Sun, 10 Jan 2016 21:32
Date: Sun, 10 Jan 2016 21:32
110 lines
4585 bytes
4585 bytes
On Sun, 13 Dec 2015 22:00:13 +0100, Julien ΓLIE wrote in
Message-Id: <n4km8u$1ra$1@news.trigofacile.com>:
> Hi,
>
> At last I'm having a look at the installation of PyClean
> https://github.com/crooks/PyClean
Hi Julien,
Apologies for not seeing this sooner, I'd accidentally unsubscribed from
the Newsgroup.
> I noted two portability issues:
>
>
> * File "/usr/lib/python2.4/site-packages/pyclean/pyclean.py", line 149
> class Binary():
> ^
> SyntaxError: invalid syntax
>
> Changing
> class Binary():
> to
> class Binary:
> fixes the issue. That syntax should also be enforced to other "class
> xxx():" in pyclean.py.
Thanks, that was easily fixed and seems to have no impact on later
versions.
> * File "/usr/lib/python2.4/site-packages/pyclean/pyclean.py", line 264
> bad_files = {f: 0 for f in bad_file_list}
> ^
> SyntaxError: invalid syntax
>
> Dict comprehensions are only available in Python 2.7 upwards. I suggest
> to use the legacy syntax:
>
> bad_files = dict((f, 0) for f in bad_file_list)
Also fixed and tested against 2.7.9.
> Well, after these two fixes for older versions of Python, I do not
> manage to run pyclean.py.
>
> Note that the install path is different from the one mentioned in INSTALL:
> "Assuming the standard locations have been used, the following
> commands can be issued:-
>
> cd ~news/bin/filter
> ln -s /usr/local/lib/python2.x/dist-packages/pyclean/pyclean.py
> filter_innd.py
> "
>
> I have /usr/lib/python2.4/site-packages/pyclean/pyclean.py instead of
> dist-packages.
I think dist-packages is a Debian thing. As I always work on Debian, I
hadn't appreciated the difference from standard.
> INN.py and filter_innd.py are in "~news/bin/filter".
> I have set PYTHONPATH to ".:~news/bin/filter" for the news user.
>
> Otherwise, I have:
>
> %python pyclean.py
> Traceback (most recent call last):
> File "pyclean.py", line 3, in ?
> import INN
> ImportError: No module named INN
Yes, you'll need the INN.py stub if Pyclean isn't not being initiated
through INN. This isn't really a bug, but it's probably worth my adding
a note to the INSTALL.
> But with PYTHONPATH set to ".:~news/bin/filter", I have:
>
> % python filter_innd.py
> Traceback (most recent call last):
> File "filter_innd.py", line 4, in ?
> from pyclean.Config import config
> File "/usr/lib/python2.4/site-packages/pyclean/pyclean.py", line 4, in ?
> from pyclean.Config import config
> ImportError: No module named Config
This is where the fun really starts! Python < 2.6 made a poor job of
handling packages with relative links to modules. I figured out how to
fix it but the fix then breaks versions >= 2.6. In the end, I think the
best solution is to merge all the packaged files into the single
pyclean.py file. This has an added advantage that the pyclean.py file
can now be put directly into the ~news/bin/filter directory (either with
a symlink or renamed to filter_innd.py). This change has now been
commited to the github repository.
Next I installed Python2.4 and tried to test against it. There are a
number of libraries that didn't exist back then, including:
hashlib
email.utils (was email.Utils)
collections (defaultdict)
These were relatively easy to workaround.
I've got the new code running on my server now but it's using
python-2.7.9. There may be runtime issues with older Pythons so I'll
create a test platform but it will take some more time.
--
What shall we use
To fill the empty spaces
Where we used to talk?
Technical Details
Message-ID:
<slrnn95jel.lfk.steve@fleegle.mixmin.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.(19219).mbox.7z!not-for-mailReferences:
<n4km8u$1ra$1@news.trigofacile.com>Show Full Headers
Complete Article Headers
Message-ID: <slrnn95jel.lfk.steve@fleegle.mixmin.net> Subject: Re: PyClean installation Date: Sun, 10 Jan 2016 21:32:05 +0000 From: Steve Crook <steve@mixmin.net> References: <n4km8u$1ra$1@news.trigofacile.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.(19219).mbox.7z!not-for-mail Newsgroups: news.software.nntp Organization: Mixmin Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sun, 10 Jan 2016 21:32:05 -0000 (UTC) Injection-Info: news.mixmin.net; posting-host="5c55cce7004733773f917c72d35d0ff7bbc6be20"; logging-data="27599"; mail-complaints-to="abuse@mixmin.net" User-Agent: slrn/pre1.0.3-6 (Linux) X-Received-Body-CRC: 2577243615 X-Received-Bytes: 4444