Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Darwin's Radio (Darwin's Radio, #1)

Cover for Darwin's Radio (Darwin's Radio, #1)

Review:

I have de­cid­ed Greg Bear is just not a writ­er I can en­joy.

His books are full of char­ac­ters to whom things just hap­pen. They don't act as much as flail around, buf­fet­ed by forces they don't un­der­stand, un­til fi­nal­ly the sto­ry just stop­s, right in time for the se­quel hook, which is prob­a­bly the part of the book that the au­thor has been think­ing about since page 20.

So, in­stead of try­ing to read Dar­win's Chil­dren and see if there is ac­tu­al­ly some fire be­hind all this smoke, I am go­ing to stop wast­ing my time, and read ac­tu­al books with ac­tu­al char­ac­ters that ac­tu­al­ly do things that ac­tu­al­ly have some ef­fect on their lives.

Anvil of Stars (Forge of God, #2)

Cover for Anvil of Stars (Forge of God, #2)

Review:

Yet an­oth­er looooong slooooow build to... well, to not much. Not re­al­ly a fun book, not re­al­ly a deep book, not re­al­ly much at al­l. Feels much longer than it is.

Shipping your PyQt app for windows


I ha­ve wri­tten about this in the pas­t, wi­th the ge­ne­ral con­clu­sion being "i­t's a pain in the ass".

So, no­w, he­re is how it's do­ne.

  1. Start wi­­th a wo­­­rking Py­­Qt appli­­ca­­tio­­n. In this exa­m­­ple, I wi­­ll use de­­vi­­cen­­zo­­.­­py mo­s­­tly be­­­cau­se:

    1. It is a wo­­­­­rking Py­­­Qt appli­­­ca­­­tio­­­n.

    2. It uses a big chunk of Py­­­Qt

    3. It's ea­sy to test

  2. Now you need a se­tu­p.­py. He­re's one that wo­rks, wi­th ex­ten­si­ve co­m­m­men­ts.

# We will be using py2exe to build the binaries.
# You may use other tools, but I know this one.

from distutils.core import setup
import py2exe

# Now you need to pass arguments to setup
# windows is a list of scripts that have their own UI and
# thus don't need to run in a console.

setup(windows=['devicenzo.py'],
      options={

# And now, configure py2exe by passing more options;

          'py2exe': {

# This is magic: if you don't add these, your .exe may
# or may not work on older/newer versions of windows.

              "dll_excludes": [
                  "MSVCP90.dll",
                  "MSWSOCK.dll",
                  "mswsock.dll",
                  "powrprof.dll",
                  ],

# Py2exe will not figure out that you need these on its own.
# You may need one, the other, or both.

              'includes': [
                  'sip',
                  'PyQt4.QtNetwork',
                  ],

# Optional: make one big exe with everything in it, or
# a folder with many things in it. Your choice
#             'bundle_files': 1,
          }
      },

# Qt's dynamically loaded plugins and py2exe really don't
# get along.

data_files = [
            ('phonon_backend', [
                'C:\Python27\Lib\site-packages\PyQt4\plugins\phonon_backend\phonon_ds94.dll'
                ]),
            ('imageplugins', [
            'c:\Python27\lib\site-packages\PyQt4\plugins\imageformats\qgif4.dll',
            'c:\Python27\lib\site-packages\PyQt4\plugins\imageformats\qjpeg4.dll',
            'c:\Python27\lib\site-packages\PyQt4\plugins\imageformats\qsvg4.dll',
            ]),
],

# If you choose the bundle above, you may want to use this, too.
#     zipfile=None,
)
  1. Run py­thon se­tu­p.­py py2exe and get a dist fol­der fu­ll of bi­na­ry good­ness.

And tha­t's it. Ex­cept of cour­se, tha­t's not it.

What this wi­ll do is crea­te a bi­na­ry se­t, ei­ther a fol­der fu­ll of things, or a sin­gle EXE fi­le. And tha­t's not enou­gh. You ha­ve to con­si­der at least the fo­llo­win­g:

  1. Put eve­­r­­y­­thing in re­­sou­r­­ce fi­­le­s: ima­­ges, qss fi­­le­s, ico­n­s, etc. Eve­­ry fi­­le your app nee­­d­s? Put it in a re­­sou­r­­ce fi­­le and load it from the­­re. That way you do­­n't ha­­ve to ca­­re about them if you go the "o­­­ne exe" road.

  2. Co­m­­pi­­le .ui fi­­les to .py (s­a­­me rea­­so­­n)

  3. Fi­­gu­­re out if you use Qt's plu­­gi­n­s, and make them wo­­­rk. This in­­clu­­des: using Pho­­­no­­n, using QtS­­Q­­L, and using any ima­­ge fo­r­­ma­­ts other than PN­­G.

After you ha­ve tha­t, are you do­ne? NO!

Your win­do­ws user wi­ll want an ins­ta­lle­r. I am not going to go in­to de­tail­s, but I had a good ti­me using Bi­tRo­ck's Ins­ta­ll­Buil­der for Qt. It's a ni­ce tool, and it wo­rks. Tha­t's a lot in this fiel­d.

But is that all? NO!

You ha­ve to take ca­re of the Vi­sual Stu­dio Runti­me. My su­gges­tio­n? Get a co­py of the 1.1MB vcre­dis­t_­x86.exe (not the lar­ger one, the 1.1MB one), and ei­ther te­ll peo­ple to ins­ta­ll it ma­nua­ll­y, or add it to your ins­ta­lle­r. You are le­ga­lly allo­wed (A­FAIK) to re­dis­tri­bu­te that thing as a who­le. But not wha­t's in it (un­le­ss you ha­ve a VS li­cen­se).

And we are do­ne? NO!

On­ce you run your app "ins­ta­lle­d", if it ever prin­ts an­y­thing to stde­rr, you wi­ll get ei­ther a dia­log te­lling you it di­d, or wor­se (if you are in ay­thing newer than XP), a dia­log te­lling you it can't wri­te to a log fi­le, and the app wi­ll ne­ver wo­rk agai­n.

This is be­cau­se py2exe ca­tches stde­rr and tries to save it on a lo­gfi­le. Whi­ch it tries to crea­te in the sa­me fol­der as the bi­na­r­y. Whi­ch is usua­lly not allo­wed be­cau­se of per­mis­sion­s.

So­lu­tio­n? Your app should ne­ver wri­te to stde­rr. Wri­te an ex­cep­thook and ca­tch tha­t. And then re­mo­ve stde­rr or re­pla­ce it wi­th a log fi­le, or so­me­thin­g. Just do­n't let py2exe do it, be­cau­se the way py2exe does it is bro­ken.

And is that it?

We­ll, ba­si­ca­lly ye­s. Of cour­se you should get 4 or 5 di­ffe­rent ver­sions of win­do­ws to test it on, but you are pre­tty mu­ch free to ship your app as you wis­h. Oh, mind you, do­n't upload it to do­wn­load­s.­com be­cau­se they wi­ll wrap your ins­ta­ller in a lar­ger one that ins­ta­lls bloa­twa­re and cra­p.

So, the­re you go.

Como les decía ayer...

Y lle­gó a un pun­to ta­l, que si me qui­sie­ra po­ner al día, ten­dría que ha­cer un post de 35 pá­gi­nas con 300 fo­to­s, 100 frag­men­tos de có­di­go, 50 ran­ts y tal vez 3 vi­deos de you­tu­be.

Así que... a la mier­da y ha­ga­mos co­mo que fué to­do un sue­ño y que us­te­des (si to­da­vía que­da más de uno) no han si­do aban­do­na­dos y es­tá to­do bien.

¿A­sí que, de que es­cri­bo? Ha­ga­mos un ranti­to corti­to.

Me po­ne tris­te y en­fu­re­ce la gen­te que di­ce con una son­ri­si­ta so­bra­do­ra "yo no sé na­da de X", don­de X, pue­de ser ma­te­má­ti­ca, te­je­r, as­tro­fí­si­ca, fú­tbo­l, cui­da­do de mas­co­ta­s, pe­lu­que­ría, ha­cer ca­fé, po­lí­ti­ca o crian­za de del­fi­nes (es­to no se apli­ca al vino. Es­tá per­fec­to que no te im­por­te sa­ber de vi­no, por­que la ma­yo­ría de los que di­cen que les in­te­re­sa mien­ten).

Hay to­ne­la­das de co­sas de las que no sé na­da. ¿Y sa­bés qué? Ca­da una es una fa­lla mía. Ca­da vez que veo te­jer a mi vie­ja, y no pue­do en­ten­der co­mo miérco­les lo ha­ce, me en­fu­re­ce.

Si bien pa­re­ce atro­na­do­ra­men­te abu­rri­do, lo que ha­ce es aga­rrar una pio­la, ha­cer­le nu­dos usan­do dos pa­li­to­s, y pro­du­cir un pu­llo­ve­r. ¿Qué ta­l? ¡Im­pre­sio­nan­te!

Ca­da vez que veo al­go que pa­re­ce abu­rri­do o po­co in­te­re­san­te, siem­pre pien­so, hay al­guien en al­gún la­do que se ha pa­sa­do años de su vi­da sien­do el me­jor en eso. Ha­y, en al­gu­na par­te, una per­so­na que es la má­xi­ma au­to­ri­dad mun­dial en co­mo atar pio­la pa­ra ha­cer un pu­llo­ve­r.

Hay al­guien que es el me­jor en po­ner azu­le­ji­tos de co­lo­res pa­ra que que­den en for­ma de delfí­n.

Hay uno que es el me­jor en usar una in­creí­ble­men­te im­pre­ci­sa la­ta de aero­sol pa­ra di­bu­jar en la pa­re­d.

Hay al­guien que pue­de ver un es­ta­cio­na­mien­to lleno de au­tos y te di­ce el or­den ló­gi­co pa­ra sa­car­los en tiem­po mí­ni­mo.

Hay al­guien que le pue­de pe­gar con un pa­lo re­don­do a una pe­lo­ti­ta que se le vie­ne en­ci­ma a 150k­m/h una de ca­da tres ve­ce­s.

Hay al­guien que le das ca­si cual­quier de­fi­ni­ción cor­ti­ta y te di­ce la pa­la­bra co­rres­pon­dien­te.

Hay uno que pue­de de­cir­te to­dos los ver­bos re­gu­la­res que em­pie­zan con T.

hay al­guien que sa­be to­do so­bre la his­to­ria del pe­rio­dis­mo en Tur­quía (pa­sé por la puer­ta del mu­seo del pe­rio­dis­mo tur­co en Es­tam­bu­l, pe­ro no pu­de en­tra­r).

Hay al­guien que sa­be to­dos los diá­lo­gos de los simp­so­n.

Ca­da una de es­tas co­sas, y mi­llo­nes má­s, pue­den pa­re­cer­me abu­rri­da­s, pe­ro es se­gu­ra­men­te por­que yo fa­llo y no no­to lo in­te­re­san­te, es una cru­de­za de mi es­píri­tu, una fa­lla de mi per­cep­ció­n, que me in­ca­pa­ci­ta y me ha­ce de­cir que eso es abu­rri­do.

El abu­rri­mien­to no es una se­ñal de su­pe­rio­ri­da­d, si no to­do lo con­tra­rio, La pr­óxi­ma per­so­na abu­rri­da que vea­s, ese que no tie­ne na­da que quie­ra ha­ce­r, que mi­ra con­des­cen­dien­te a al­guien apa­sio­na­do por lo que sea, es un po­bre ti­po.


Contents © 2000-2024 Roberto Alsina