On Thu, Dec 17, 2009 at 3:48 PM, Stefan Behnel <[email protected]> wrote:
>
> Dag Sverre Seljebotn, 17.12.2009 19:01:
>> Lisandro Dalcín wrote:
>>> I'm experimenting with running Cython from a zip file containing the
>>> minimum code required to get a fully functional Cython compiler.
>>>
>>> So far, I can make a zipfile of about 290K
>>>
>>> $ ./mklite.sh ../cython-devel
>>> $ ls -alh cython.zip
>>> -rw-r--r--. 1 dalcinl users 289K 2009-12-17 14:01 cython.zip
>>>
>>> Then I can run cython from the zip file setting PYTHONPATH and using 
>>> 'python -m'
>>>
>>> $ touch tmp.pyx
>>> $ PYTHONPATH=./cython.zip python -m cython tmp.pyx
>>> Unable to hash scanner source file ([Errno 20] Not a directory:
>>> '/u/dalcinl/Devel/Cython/LITE/cython.zip/Cython/Compiler/Lexicon.py')
>>> Creating lexicon...
>>> Done (0.15 seconds)
>>> Warning: Unable to save pickled lexicon in
>>> /u/dalcinl/Devel/Cython/LITE/cython.zip/Cython/Compiler/Lexicon.pickle
>>>
>>> but these warnings are REALLY annoying.
>>>
>>> Assuming I could determine in Cython sources that Cython is being used
>>> from a zipfile (ideas?) ... Could I add some hackery to silent these
>>> annoying warnings?
>
> You could check if the directory you are trying to write to really is a
> directory. If not, we shouldn't try to use pickle.
>

OK.

>
> BTW, why isn't the lexicon pickled already in the case above?
>

Lexicon.pickle is inside the zip file, but Cython code is treating to
read Lexicon.pickle from a "standard" filesystem file, so it fail.

In short, the Lexicon.pickle packaged inside the zip is useless.

Moreover, as

Creating lexicon...
Done (0.08 seconds)

is SO FAST, I'm not interested at all in complicating the zip file
support for actually using a pickled Lexicon.


>
>> I wouldn't even consider that hackery...the Python warnings module even
>> has explicit code for temporary or permanent warning silencing (though I
>> guess that might not be Py2.3).

Well, the point is that as there is no (easy) way to use
Lexicon.pickle when running Cython from a zip file, then the warning
is pointless... Then I asked about your opinions about removing the
warning, but ONLY in the case I can figure out that Cython is actually
being used from a zip file.


>
> No need to silence a warning that we generate ourselves.
>

Unless the warning is pointless, as in this very specific use case.


PS: It could seem that I'm worrying too much about this, but I want
this feature to function really well. This is really nice way to
easily "upgrade"/"downgrade" your Cython version for building specific
projects... This is going to be important if Cython ever gets its way
to Python's stdlib. It is also important if you are using some Linux
distro where Cython-0.11 is in the system install, but you need to
build the -dev copy of some Cython-based project that requires 0.12...
Then a user can download the big 4.3MB Cython-0.12.zip (or a lite,
striped version with 290KB like the one I'm trying to do) and get the
-dev code cythonized.


-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to