[Distutils] setup('postinstall'='my.py')

Leonardo Rochael Almeida leorochael at gmail.com
Wed Feb 3 11:10:39 EST 2016


Hi,

The thing about setup.py is that it only runs at "build time".

However, it looks like you want to generate a unique id at every install.

Since you mentioned a windows installer, consider adding some code to the
installer itself so that it calls an entry point in your library to
generate this unique id at that moment.

Sorry, there isn't any support in setuptools to do this from within
setup.py itself.

Regards,

Leo

On 3 February 2016 at 13:31, AltSheets Dev <altsheets+mailinglists at gmail.com
> wrote:

> Thanks a lot!
>
> I could get that working!
> See setup.py lines 13 and 69 in
>
> https://github.com/altsheets/coinquery/blob/f1759a6dd5cd891f493da343c52e8184b45fc926/setup.py
>
> BUT
> my custom install routines are called
> when the windows installer binary is CREATED,
> not when it is UNPACKED on the target machine.
>
> e.g. this coinquery-0.2.4.win-amd64.exe
> https://github.com/altsheets/coinquery/tree/master/debug
>
> when unpacked ... always results in the same UID sz4u0zrqkas3q8s3t0se
> you can see that when you type
>
> hello
>
>
> Any hints?
>
> Thanks.
>
>
>
> On 3 February 2016 at 00:00, Robert T. McGibbon <rmcgibbo at gmail.com>
> wrote:
>
>> One very simple technique used by some projects like numpy is just to
>> have ``setup.py`` write a file into the source tree before calling setup().
>>
>> example: https://github.com/numpy/numpy/blob/master/setup.py#L338-L339
>>
>> -Robert
>>
>> On Tue, Feb 2, 2016 at 1:48 PM, AltSheets Dev <
>> altsheets+mailinglists at gmail.com> wrote:
>>
>>> Hello everyone on distutils-sig@,
>>> this is a first timer, please be gentle to me *g*
>>>
>>> I am just starting with setuptools,
>>> and I just cannot get my idea working:
>>>
>>> At install time,
>>> I'd like to generate a file with a random UID,
>>> which will later always be the same.
>>>
>>> I had hoped for a setup('postinstall'='my.py') or setup('preinstall'=
>>> ...) but there isn't one.
>>>
>>> Then I have been trying with a customized
>>> distutils.command.install.install
>>> class - but so far with no success.
>>>
>>> Here is a detailed explanation of my futile attempts:
>>> https://github.com/altsheets/coinquery/blob/master/README-setupCustom.md
>>>
>>> I guess this is be a pretty frequent question?
>>>
>>> Happy about any hints.
>>>
>>> Thanks.
>>> :-)
>>>
>>>
>>>
>>> _______________________________________________
>>> Distutils-SIG maillist  -  Distutils-SIG at python.org
>>> https://mail.python.org/mailman/listinfo/distutils-sig
>>>
>>>
>>
>>
>> --
>> -Robert
>>
>
>
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> https://mail.python.org/mailman/listinfo/distutils-sig
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20160203/fcb09cea/attachment-0001.html>


More information about the Distutils-SIG mailing list