How to package executables

Norbert Preining norbert at preining.info
Tue Jul 21 06:29:35 CEST 2020


Hi Adam,

funny discussion that is ;-)

> Because it's more readable than Perl, Norbert (but so is line
> noise, for that matter) :P.

Kind of disagree, even after long long time or writing Python code.

> Yes, and it can still be loaded as a module. I've never seen a
> module with all code directly in the __init__.py file; it's
> a sentinel to tell Python that a directory is a package, as I

No, there are lots of modules that put all the code into __init__,
and yes, it is still the sentinel so it might be empty, too.
Nothing has changed in this respect.

> Agreed. A single file makes more sense for TL, and you can still put
> a __main__ function in it and make it executable. I put everything

That is what I normally do.

> into a file called spix.py, but my testing failed since I don't have
> python3 installed. File here, if it's helpful as a starting point:

Nearly there, only two changes where necessary:
	import argparse
was dropped, and two occurrences of
	spix.XXXXXX
need to be replaced simply with
	XXXXXX

spix.compiletex -> compiletex
spix.SpixError -> SpixError

That's it.

> Well, for search path and module naming, but you can also get
> around that, IIRC. I think of object encapsulation as your code,

Yes, of course, you **can** get around it, but it is a huge pain in the
butt. Trying to import not module files from outside the CWD is eg
a huge pain, something like
	import XXX from .foo.bar
etc will throw off Python(3).

So yes, as with any turing complete programming language with a minimal
level of introspection, you can do whatever you want. It is just - first
shoot yourself 20 times and then give up.

I know, Pythonistas will come after me and tell me what they always do
	You are not doing it the Python way!
	Use proper modules!
And that is one of the reasons I despise Python. I don't want to get
forced into a specific way of doing things. It should be a
recommendation, but not forced upon us.

Anyway, that is all off topic ranting.

Best

Norbert

--
PREINING Norbert                              https://www.preining.info
Accelia Inc. + IFMGA ProGuide + TU Wien + JAIST + TeX Live + Debian Dev
GPG: 0x860CDC13   fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13


More information about the tex-live mailing list.