I see. A setup.py install puts everything in /home/weewx. Nothing is added 
to any paths nor are any shell scripts created. If a user wants to run, for 
example, wee_database they need to be in the /home/weewx/bin directory or 
they need to prepend a suitable path when running wee_database.

I think you are playing with fire putting files in directories other than 
user and skins; chances are eventually they are going to be deleted. Why 
not keep it simple and place your scrips in the user directory and have the 
WeeWX user include a path when running the command . This is not uncommon, 
in fact it is done to some extent when running a driver directly. Certainly 
saves a whole pile of heartache worrying about what a package installer 
does and the subtle differences across versions and distros.

>From the Zen of Python 
<https://www.python.org/dev/peps/pep-0020/#the-zen-of-python> ‘Simple is 
better than complex.’

Gary
On Tuesday, 20 July 2021 at 17:41:15 UTC+10 kk44...@gmail.com wrote:

> The apt-get installation places some shell scripts (among them 
> wee_database) into /usr/bin. That is outside the WeeWX tree. The reason for 
> that is to place those scripts somewhere in the search path. I am not sure, 
> where the setup.py installation puts those scripts. 
>
> In my case there is a script like wee_database to add the observation 
> types provided by the extension to the data_base. As the user shall call it 
> separately it must be found within the search path.
>
> And I have no glue, how to do that.
>
> I placed the Python part of the script in the bin directory (not bin/user, 
> bin only). But what to do with the shell part of the script?
>
> gjr80 schrieb am Montag, 19. Juli 2021 um 22:47:23 UTC+2:
>
>> I’m not sure if I understand your question correctly but provided you are 
>> setting the ‘files’ parameter in install.py you can fairly much put 
>> anything anywhere in the WeeWX bin and skins tree branches irrespective of 
>> WeeWX install type (eg specifying bin/user will see the installer 
>> automatically use the correct location of either /home/weewx/bin/user or 
>> /usr/share/weewx/user depending on the install type). Of course I could be 
>> misunderstanding your question completely.
>>
>> One other thing, be wary of placing code outside of the user and skins 
>> directories; files placed anywhere else in the WeeWX tree may not survive a 
>> WeeWX upgrade.
>>
>> Gary
>>
>> On Monday, 19 July 2021 at 20:28:25 UTC+10 kk44...@gmail.com wrote:
>>
>>> I wrote an extension to read the values out of an air quality device. It 
>>> supplies a lot of observation types not included in the standard database 
>>> schema. So I wrote a little utility to add the necessary columns to the 
>>> database (or drop them from it).
>>>
>>> Now the problem:
>>>
>>> The utilities of WeeWX like wee_database all are started by a little 
>>> wrapper shell script. But the location of that shell scripts depends on 
>>> installation way like setup.py or apt-get. How can I define that wrapper 
>>> script in install.py that it is put to the right place during installation?
>>>
>>> https://github.com/roe-dl/weewx-airQ
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-development+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/15100b9c-53ef-43c9-a427-bc2519995a32n%40googlegroups.com.

Reply via email to