Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about marave (old posts, page 1)

Packaging and shipping is HARD

I have worked re­al­ly hard on Mar­ave, a full screen ed­i­tor in the style of ommwriter, Dark­Room, Write­Room, py­Room, etc. I have worked very hard and I want users to use it.

Or not even that, I want them to have a chance of us­ing it.

That means I want it to work on Win­dows (and maybe OSX some day, too, if some­one helps me). Which mean­s, I have to pak­age it for win­dows.

Let's do a quick com­par­i­son here from the points of view of the us­er and the de­vel­op­er.

The User, In Linux

This is in Arch Lin­ux, which is what I use, in oth­er Lin­ux vari­ants it will be pret­ty much the same once Mar­ave is a bit more well known.

yaourt -S marave-svn --noconfirm

That gets the code from SVN (right now it's the best way, lat­er I will pack­age re­leas­es, too), all re­quired de­pen­den­cies, builds and in­stall­s. It takes all of 15 sec­onds in my note­book.

Af­ter that, you have a ful­ly work­ing Mar­ave.

In case it's not pack­aged for your dis­tro, just in­stall PyQt (which sure­ly is) and run this com­mand:

easy_install marave

The User, in Windows

You go to http://­mar­ave.­google­code.­com, click on "Mar­ave-0.5.win32.ex­e" (Not linked yet, it's not fin­ished), then down­load a 10MB pro­gram. That is a 10MB pro­gram be­cause win­dows does­n't be­lieve in pack­ages and de­pen­den­cies. On Lin­ux, a Mar­ave pack­age could be un­der 1MB (most of it im­ages), and not be ex­e­cutable, just da­ta.

Of course nowa­days web browsers don't ac­tu­al­ly run pro­grams on down­load, so... let's see it as a gallery!

110111105613-My-Desktop

Yes, save it.

11011111220-My-Desktop

Dou­ble click to open it

11011111417-My-Desktop

Yes, I agree

11011111514-My-Desktop

Sure, what­ev­er

1101111167-My-Desktop

Nice...

11011111750-My-Desktop

Good to hear!

Now, this Mar­ave that just got in­stalled may or may not cur­rent­ly work be­cause of a miss­ing MSVCR90.DLL but that's for the next sec­tion...

The Developer, in Linux

First, here's the big­gest prob­lem a Lin­ux pack­ager can have:

Since Mar­ave is a new ap­p, and I de­vel­op it in the rather cut­ting-edge Arch Lin­ux, it us­es some newish fea­tures on­ly avail­able in re­cent ver­sions of Qt. In fac­t, it does­n't work with PyQt < 4.6, which is not avail­able in some slow dis­tros, like De­bian, or even in a not-lat­est Ubun­tu.

So­lu­tion? Well, I could just ig­nore it, but what the heck, let's fix it in­stead!

Thanks to PyIn­staller it's not even hard to do, here's the spec file:

a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), os.path.join(HOMEPATH,'support/useUnicode.py'), 'marave/main.py'],
            pathex=['/home/ralsina/trunk/trunk'])

pyz = PYZ(a.pure)
exe = EXE(pyz,
        a.scripts,
        exclude_binaries=1,
        name=os.path.join('build/pyi.linux2/main', 'marave.exe'),
        debug=False,
        strip=False,
        upx=True,
        console=0 )

coll = COLLECT( exe,
            a.binaries,
            [('radios.txt','marave/radios.txt','DATA')],
            Tree('marave/icons','icons'),
            Tree('marave/backgrounds','backgrounds'),
            Tree('marave/clicks','clicks'),
            Tree('marave/stylesheets','stylesheets'),
            Tree('marave/themes','themes'),
            a.zipfiles,
            a.datas,
            strip=False,
            upx=True,
            name=os.path.join('dist', 'marave'))

Use this, and PyIn­staller will pro­duce a nice fold­er full of ev­ery­thing Mar­ave needs to run on any Lin­ux.

OTO­H, if you can re­ly on a re­cent PyQt be­ing avail­able, it's al­so sim­ple. Here's a pack­ag­ing con­fig­u­ra­tion for a sim­i­lar pack­age in Arch Lin­ux (I must con­fess not hav­ing done one for Mar­ave yet). For oth­er dis­tri­bu­tions it should be about as sim­ple, if more ver­bose, and some­one else prob­a­bly does it for you:

# Contributor: Roberto Alsina <ralsina@kde.org>
pkgname=python-rst2pdf
pkgver=0.12.1
pkgrel=4
pkgdesc="Create PDFs from simple text markup, no LaTeX required."
arch=('i686' 'x86_64')
url="http://rst2pdf.googlecode.com"
license=('custom')
depends=('python' 'setuptools' 'docutils' 'pygments' 'python-reportlab' 'python-simplejson' 'pil')
source=(http://rst2pdf.googlecode.com/files/rst2pdf-$pkgver.tar.gz LICENSE.txt)
optdepends=('uniconvertor: vector images support'
            'python-svglib: SVG support'
            'python-wordaxe: hyphenation'
            'pythonmagick: PDF images support')
build() {
cd $startdir/src/rst2pdf-$pkgver
python setup.py install --root=$startdir/pkg || return 1
install -D ../LICENSE.txt $startdir/pkg/usr/share/licenses/python-rst2pdf/COPYING
install -D doc/rst2pdf.1 $startdir/pkg/usr/share/man/man1/rst2pdf.1
}
md5sums=('ea6beda9a46f34ba42c4c94d48cc607a'
        '416f8046c66b9476cdbacda69a673afe')

And that's all you need to know about the process of pack­ag­ing your app for Lin­ux. It's easy to do, and most of the time, easy to do right!

Now, let's go to our fi­nal sec­tion...

Windows for the developer

First, re­mem­ber that of re­ly­ing on the sys­tem's ver­sion of Qt? For­get it, there is no sys­tem ver­sion avail­able. And no python ei­ther. And noone is go­ing to in­stall it or your ap­p, so it's "ship ev­ery­thing your­self" mod­e, or noth­ing.

But any­way, PyIn­staller works for Win­dows too! So, us­ing the same spec file, it work­s. Right?

Well, no beause of two prob­lem­s.

Problem 1: You need an installer

Users are not go­ing to open a zip some­where, then do a short­cut to the bi­na­ry on Win­dows, so you need to do some op­er­a­tions, and that means an in­stall­er.

Here's what I came up with to use NSIS, a free in­stall­er cre­ator for Win­dows:

;--------------------------------
;Include Modern UI

!include "MUI2.nsh"

;--------------------------------
;General

;Name and file
Name "Marave"
OutFile "Marave-0.5.win32.exe"

;Default installation folder
InstallDir "$LOCALAPPDATA\Marave"

;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Marave" ""

;Request application privileges for Windows Vista
RequestExecutionLevel user

;--------------------------------
;Interface Settings

!define MUI_ABORTWARNING

;--------------------------------
;Pages

!insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"

;--------------------------------
;Installer Sections

Section "Install"

SetOutPath "$INSTDIR"
File /r "dist\marave"


;Store installation folder
WriteRegStr HKCU "Software\Marave" "" $INSTDIR

;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

;Create shortcuts
CreateDirectory $SMPROGRAMS\Marave
CreateShortCut "$SMPROGRAMS\Marave\Marave.lnk" "$INSTDIR\marave\marave.exe" ; use defaults for parameters, icon, etc.
CreateShortCut "$SMPROGRAMS\Marave\Uninstall Marave.lnk" "$INSTDIR\Uninstall.exe" ; use defaults for parameters, icon, etc.

SectionEnd


;--------------------------------
;Uninstaller Section

Section "Uninstall"

Delete "$INSTDIR\Uninstall.exe"
RMDir /r "$INSTDIR"

DeleteRegKey /ifempty HKCU "Software\Marave"

SectionEnd

It's com­pa­ra­ble to the ef­fort of build­ing a pack­ag­ing file, re­al­ly, ex­cept ev­ery time you want to test it... you in­stall it. There is no way (AFAIC­S) to see what's in­side the in­stall­er ex­cept run­ning it!

When things fail, you get no er­ror mes­sages, at least not the kind that is use­ful for a de­vel­op­er, the guy that needs to know what went wrong.

And af­ter it's fin­ished, you may end with a non-­work­ing pro­gram be­cause of...

Problem 2: system libraries don't exist

Python 2.6 bi­na­ries are built us­ing Vis­ual Stu­dio. That means they re­quire the Vis­ual Stu­dio Run­time, specif­i­cal­ly MSVCR90.DL­L. That con­tains what on Lin­ux would be con­sid­ered part of libc. (lin­ux guy: imag­ine apps that de­pend on a spe­cif­ic libc... hard to do!)

On Lin­ux that's part of the sys­tem. Fur­ther, if you want­ed, you can re­dis­tribute it. On Win­dows... well, it's a bit dif­fer­en­t.

  1. It's part of the "Vi­­su­al C++ re­dis­­tribu­ta­bles"

  2. In­­stalling that does­n't guar­an­­tee it will work (yes, I have tried)

  3. The li­­cense for those 're­dis­­tribu­ta­bles' says you can't make them avail­able for down­load.

    I have been told that in­­­clud­ing that in your in­­stal­l­er is fine and dandy, but how is that not mak­ing them avail­able for down­load?

So what can you do when you need a li­brary and can't ship it and the us­er won't in­stall it?

Well, that's why there is no Win­dows bi­na­ry of Mar­ave yet. Of course if any­one can help, I'd be re­al­ly, re­al­ly hap­py!

Marave 0.4 is out!

Ver­sion 0.4 of Mar­ave, a dis­trac­tion-free fullscreen ed­i­tor is out at http://­mar­ave.­google­code.­com

This ver­sion in­cludes sev­er­al bugs fixed and fea­tures im­ple­ment­ed since 0.4:

  • It works bet­ter with Win­­dow­­Mak­er (di­alogs ap­­peared be­hind main win­­dow)

  • Works bet­ter with some Qt styles (com­bo box­es were un­us­able)

  • Added sup­­port for SVG back­­­grounds

  • Code cleanups

Mar­ave is free soft­are re­leased un­der the GPL, and should work in all ma­jor desk­top plat­form­s.

I would love feed­back on this re­lease, as well as ideas for Mar­ave's fu­ture, so if you want to help, please join the mail­ing list:

http://­group­s.­google.­com/­group/­mar­ave-dis­cuss

Of course, if you like Mar­ave, feel free to give me mon­ey

Marave 0.3 is out!

Ver­sion 0.3 of Mar­ave, a dis­trac­tion-free fullscreen ed­i­tor is out at http://­mar­ave.­google­code.­com

This ver­sion in­cludes sev­er­al bugs fixed and fea­tures im­ple­ment­ed since 0.2:

  • New 'Styles' sup­­port, you can change the look of Mar­ave with CSS syn­­tax

  • De­bugged themes sup­­port, a few themes in­­­clud­ed

  • Fixed bug sav­ing text col­or

  • Fixed font chang­ing bug

  • Use the doc­u­­ment name in win­­dow ti­­tle

  • "Now play­ing" no­ti­­fi­­ca­­tion

Mar­ave is free soft­are re­leased un­der the GPL, and should work in all ma­jor desk­top plat­form­s.

I would love feed­back on this re­lease, as well as ideas for Mar­ave's fu­ture, so if you want to help, please join the mail­ing list:

http://­group­s.­google.­com/­group/­mar­ave-dis­cuss

Of course, if you like Mar­ave, feel free to give me mon­ey

Marave 0.2 is out!

Ver­sion 0.2 of Mar­ave, a dis­trac­tion-free fullscreen ed­i­tor is out at http://­mar­ave.­google­code.­com

This ver­sion in­cludes sev­er­al bugs fixed and fea­tures im­ple­ment­ed since 0.1.1:

  • A cor­rup­t­ed Right-click menu (Is­­sue 20)

  • Flick­­er­ing on back­­­ground changes

  • More de­­tailed li­­cen­s­ing in­­­for­­ma­­tion

  • More test­ed on Win­­dows

  • Added help (F1)

  • Search & Re­­place (but re­­place all is not done)

  • New art­­work

  • Sta­­tus no­ti­­fi­­ca­­tions

  • Doc­u­­ment In­­­fo (C­tr­l+I)

  • Bet­ter feed­back in the UI el­e­­ments (spe­­cial­­ly the but­­ton­s)

  • Save font size cor­rec­t­­ly

  • Fix "S­­tarts in the back­­­ground" prob­lem (Is­­sue 17)

Mar­ave is free soft­are re­leased un­der the GPL, and should work in all ma­jor desk­top plat­form­s.

I would love feed­back on this re­lease, as well as ideas for Mar­ave's fu­ture, so a mail­ing list for Mar­ave has been opened:

http://­group­s.­google.­com/­group/­mar­ave-dis­cuss

Of course, if you like Mar­ave, feel free to give me mon­ey

Marave 0.1 released, please test!

The first "good" ver­sion of Mar­ave my re­lax­ing text ed­i­tor is out!

What is Mar­ave?

Mar­ave is an ed­i­tor that does­n't dis­tract you. It has a fullscreen in­ter­face, and most of the time, while you write, you will on­ly see your tex­t, and maybe a back­ground:

marave1

Of course it is al­so quite con­fig­urable:

marave2

Some of the fea­tures:

  • Cus­­tom back­­­grounds (im­ages or col­ors)

  • Font and font size are con­­fig­urable

  • Re­­size­able ed­i­­tor of con­­fig­urable opac­i­­ty

  • "Van­ish­ing" UI, when you tipe, it all goes away

  • Op­­tion­al me­­dia play­er (right now aimed at stream­ing au­­dio, maybe sound­s­capes some­­day)

  • Op­­tion­al au­­dio feed­back for the key­board (just in case you miss the old type­­writer)

  • Theme sup­­port

  • Mul­ti­lin­gual spellcheck­­ing (re­quires pyen­chan­t)

Mar­ave is im­ple­ment­ed us­ing PyQt, so it should work in all ma­jor plat­form­s, Win­dows, Lin­ux and Mac OS­X, as long as you have PyQt in­stalled.

In the fu­ture, easy to use bi­na­ries will be pro­vid­ed for Win­dows and Mac.

This ver­sion is not fea­ture com­plete. Specif­i­cal­ly:

  • Search+Re­­place is not done

  • There may be some cus­­tomiza­­­tions not im­­ple­­men­t­ed

Down­load Mar­ave 0.1

UP­DATE 0.2 is out, at http://­code.­google.­com/p/­mar­ave/­down­load­s/list