On gio, 2011-12-08 at 13:26 +0100, Hartmut Goebel wrote: > Hi, > > I have a ticket "eliminate config.dat file" targeted for Release 1.6 > (http://www.pyinstaller.org/ticket/347) and am thinking about the > implementation. > > Your input is appreciated. > > Removing this file basically means dropping utils/Configure.py, which > does three jobs: > 1) collect configuration data and generate config.dat > 2) generate file CONFIGDIR/support/useUnicode.py > 3) generate file CONFIGDIR/support/useTk.py
I agree with the overall goal of removing utils/Configure.py and config.dat. > 2) For useUnicode (see http://www.pyinstaller.org/ticket/474) > > In makespec.py: if the option --ascii is not given, add a script > HOMEPATH/support/loadUnicode.py: > try: import encodings > except ImportError: > try: import codings > except ImportError: pass > This basically moves the detection on which unicode module to use to the > build time. At run-time whatever module is available is imported (using > the same semantic as configure does at the moment.) > > On the other hand: there is not need to import these modules at runtime. > We only need to package the data. > > PS: We do not need to import the modules at run time, since this is done > by Python. We need to take care the modules are packaged. So there us a > alternate solution: Add another parameter `hidden_imports` to Analysis() > and preset it with `encoding` and `codecs` if `--ascii` is not given. > This will include the required files. One issue I had from the start is that PyInstaller only allows for ascii vs unicode. I think that what it should really allows for is a user-configurable list of codecs. For instance, many people will want just utf-8 support, but right now they need to use unicode for that. I know this is a different topic, but since we're refactoring the codec support I think it makes sense to know where we're heading. My suggestion is to add a Codecs() call in spec files to be used like this: a = Analysys(....) a += Codecs(["utf-8"]) One available codec will be "all" which means "all codecs available in the current Python installation". So basically when you use pyinstaller --unicode, it will generate the line a += Codecs(["all"]) in the spec file; if you use --ascii, it will not generate a Codecs() line at all. I think this is a superior design that removes the need of the useUnicode.py and at the same time allows for full flexibility for the end user. > 3) For useTk: (http://www.pyinstaller.org/ticket/475) > > This can go into a runtime-hook, too. > > configure puts the version number into a string. But we can get the > string in the run-time-hook by using glob(). I think that PyInstaller's TK support should be all migrated to regular hooks/rthooks and totally removed from Configure and Makespec. PyInstaller has now enough features for regular hooks to support TCL/TK without needing special code. Support for TK is made of three parts: * config.dat creates useTK.py, which basically is a runtime-hook. I agree that it could simply use glob() and become a standard runtime-hook. * unpackTk/removeTk: this are hard-coded runtime-hooks which are added by Makespec.py to the rthook list. They unpack (and later remove) a tree of TK-related data files, using carchive APIs. This is *exactly* what we already do for matplotlib, but through a standard hook. This custom code for TK has totally been made obsolete by data files/trees support in standard hooks. We can remove it and simply write a hook for Tk that packages all required data files. -- Giovanni Bajo :: Develer S.r.l. [email protected] :: http://www.develer.com Blog: http://giovanni.bajo.it Last post: The algorithms behind OTP tokens -- You received this message because you are subscribed to the Google Groups "PyInstaller" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.
