[tech] uccvend-vendserver patch - VendServer.py executable on install

Sam Spilsbury smspillaz at gmail.com
Thu Mar 5 20:01:09 AWST 2015


Hi,

On Thu, Mar 5, 2015 at 7:08 PM, Mitchell Pomery <mjpomery at ucc.asn.au> wrote:
> Hi Mark,
>
> I've found a way to make sure that VendServer.py is an executable on
> install, mark all the python files as executable. This is an interim measure
> until I can figure out what setuptools is doing.

I don't mean to be nosy (and I'm making some assumptions about the
particular tool at issue here), but I just saw this one fly past my
inbox and thought some feedback might be helpful.

Making every python file in the distribution is probably not what you
want - most python files aren't supposed to be executed directly.

>
> Speaking of setuptools, is it really required, or can we roll our own
> utility that is nicer and does exactly what we need? It will also reduce our
> dependancies.

Setuptools has an entry_points option where you can dynamically create
a script to launch your application[1]. For example, you could have:

entry_points=[
    "console_scripts": [
        "vend-server=VendServer.VendingMachine:main"
    ]
]

That would run the main() function on execution of the "vend-server"
command after installation.

Hope that's useful :)

Sam.

[1] http://setuptools.readthedocs.org/en/latest/setuptools.html#automatic-script-creation

>
> Thanks,
> Mitchell Pomery
> UCC President 2014
> _______________________________________________
> List Archives: http://lists.ucc.gu.uwa.edu.au/pipermail/tech
>
> Unsubscribe here:
> http://lists.ucc.gu.uwa.edu.au/mailman/options/tech/smspillaz%40gmail.com



-- 
Sam Spilsbury


More information about the tech mailing list