On Mon, Jan 16, 2023 at 6:44 PM matthew wall <[email protected]> wrote:

>
>
> On Monday, January 16, 2023 at 8:50:35 PM UTC-5 Tom Keffer wrote:
> at 'station create' time, why not just copy all of the parameterized utils
> into the utils directory, without replacing any parameters?
> (by 'parameters' i mean the WEEWX_ROOT, WEEWX_BINDIR, WEEWX_CFGDIR and
> others like them.  btw we need to canonicalize that list...)
>
> weectl station create does exactly this, although in a backwards
> compatible way.
>
> we might have a different interpretation of 'backward compatible'.  when i
> say 'backward compatible', this means that i can take any old weewx config
> file, and it will work, unmodified, with the latest backward-compatible
> release.  there should be no need to modify the config - if there is, then
> that weewx release is not backward compatible.
>

What I meant by the "in a backwards compatible way" comment is that it
doesn't actually use your symbols. It uses the old symbols.

Here's the diff between the V4.9.1 weewx.conf and the V5 version:


tkeffer@gray-owl-air weewx-4.9.1 % diff weewx.conf  -c
~/git/weewx/bin/wee_resources

*** weewx.conf Tue Oct 25 04:28:25 2022

--- /Users/tkeffer/git/weewx/bin/wee_resources/weewx.conf Sun Jan 15
15:07:38 2023

***************

*** 13,18 ****

--- 13,21 ----

  # Root directory of the weewx data file hierarchy for this station

  WEEWX_ROOT = /home/weewx



+ # Where the 'user' directory is located, relative to WEEWX_ROOT:

+ USER_ROOT = bin/user

+

  # Whether to log successful operations. May get overridden below.

  log_success = True



***************

*** 20,26 ****

  log_failure = True



  # Do not modify this. It is used when installing and updating weewx.

! version = 4.9.1




##############################################################################



--- 23,29 ----

  log_failure = True



  # Do not modify this. It is used when installing and updating weewx.

! version = 5.0.0a11




##############################################################################



***************

*** 28,35 ****



  [Station]



!     # Description of the station location

!     location = "My Little Town, Oregon"



      # Latitude in decimal degrees. Negative for southern hemisphere

      latitude = 0.00

--- 31,38 ----



  [Station]



!     # Description of the station location, such as your town:

!     location = "WeeWX station"



      # Latitude in decimal degrees. Negative for southern hemisphere

      latitude = 0.00

***************

*** 46,52 ****



      # If you have a website, you may specify an URL. This is required if
you

      # intend to register your station.

!     #station_url = http://www.example.com



      # The start of the rain year (1=January; 10=October, etc.). This is

      # downloaded from the station if the hardware supports it.

--- 49,55 ----



      # If you have a website, you may specify an URL. This is required if
you

      # intend to register your station.

!     #station_url = https://www.example.com



      # The start of the rain year (1=January; 10=October, etc.). This is

      # downloaded from the station if the hardware supports it.

***************

*** 457,464 ****

      # Defaults for SQLite databases

      [[SQLite]]

          driver = weedb.sqlite

!         # Directory in which the database files are located

!         SQLITE_ROOT = %(WEEWX_ROOT)s/archive



      # Defaults for MySQL databases

      [[MySQL]]

--- 460,467 ----

      # Defaults for SQLite databases

      [[SQLite]]

          driver = weedb.sqlite

!         # Directory in which the database files are located, relative to
WEEWX_ROOT:

!         SQLITE_ROOT = archive



      # Defaults for MySQL databases
      [[MySQL]]


The only substantive differences is the addition of USER_ROOT (the location
of the user subdirectory) and the change of SQLITE_ROOT (to be relative to
WEEWX_ROOT). The former is not really necessary, but it seemed like a good
idea because 'user' is no longer located amongst the rest of the weewx
code. The default is to find it at $WEEWX_ROOT/bin/user, which works for a
pip install. For a package install, it will be in the regular PYTHONPATH,
so it doesn't need USER_ROOT at all. I could remove it, but, like I said,
it seems like a good idea...

i realize that the convention for weewx has been to modify a user's config
> file during an upgrade.  to me, this is not "backward compatible", this is
> an upgrade of the config file.
>

A v4.9.1 weewx.conf can be run in a v5 environment without change. It is
not modified by the upgrade process.



> just to clarify: at some point we explicitly separated the
> config-file-upgrade code so that dpkg/rpm could invoke that independently
> of upgrading the weewx code.  now this will be available as 'weectl station
> upgrade' - upgrade the indicated weewx config file - with a separate option
> for explicitly upgrading the skins.
>

The weectl station upgrade command runs the old upgrade code to get an
ancient weewx.conf up to something modern. It doesn't do anything to a
V4.3+ weewx.conf. However, it does upgrade the docs, examples, and utility
files.

I haven't written it yet, but weectl station upgrade-skins will upgrade the
skins.

Give it a try:
>
> *pip install weewx --user*
> *weectl station create*
> *sudo cp ~/weewx-data/systemd/weewx.service /etc/systemd/system*
>

I didn't help my case by including a typo. It should be

*sudo cp ~/weewx-data/util/systemd/weewx.service /etc/systemd/system*


>
That's it to get a daemon going.
>
> fwiw, this is what i get on an ancient macos (intel) using anaconda3
> (python 3.8):
>
> % which pip
> /Volumes/Software/sw/anaconda3/bin/pip
> % pip install weewx --user
> Requirement already satisfied: weewx in
> ./.local/lib/python3.8/site-packages (5.0.0a4)
> Requirement already satisfied: PyMySQL<2.0,>=1.0 in
> ./.local/lib/python3.8/site-packages (from weewx) (1.0.2)
> Requirement already satisfied: configobj>=4.7 in
> /Volumes/Software/sw/anaconda3/lib/python3.8/site-packages (from weewx)
> (5.0.6)
> Requirement already satisfied: six<2,>=1 in
> /Volumes/Software/sw/anaconda3/lib/python3.8/site-packages (from weewx)
> (1.15.0)
> Requirement already satisfied: Pillow<10.0,>=9.3 in
> ./.local/lib/python3.8/site-packages (from weewx) (9.3.0)
> Requirement already satisfied: pyusb<2.0.0,>=1.0.2 in
> ./.local/lib/python3.8/site-packages (from weewx) (1.2.1)
> Requirement already satisfied: pyephem<4.0,>=3.7 in
> ./.local/lib/python3.8/site-packages (from weewx) (3.7.7.0)
> Requirement already satisfied: CT3<4.0,>=3.1 in
> ./.local/lib/python3.8/site-packages (from weewx) (3.3.1)
> Requirement already satisfied: pyserial<4.0,>=3.4 in
> ./.local/lib/python3.8/site-packages (from weewx) (3.5)
> Requirement already satisfied: ephem==3.7.7.0 in
> ./.local/lib/python3.8/site-packages (from pyephem<4.0,>=3.7->weewx)
> (3.7.7.0)
>
> % export PATH=/Users/mwall/.local/bin:$PATH
> % weectl --version
> weectl v5.0.0a4
> % weectl station create
> The configuration file will be created at /Users/Shared/weewx/weewx.conf.
>

...
>
> i expected it would have defaulted to $HOME/weewx-data, not
> /Users/Shared/weewx. it succeeded only because i had /Users/Shared/weewx
> and had permissions on that dir leftover from macos testing.
>
> apparently 'weectl station create' does not install the utils:
> ...
>
>
You're still using a very old version of V5. Try it with --upgrade.


regarding the directory specifications in the weewx config file:
> 1) is SQLITE_ROOT relative to WEEWX_ROOT *only* if it is a relative path?
> (where relative path is something that starts with anything other than /)
> so i assume that "SQLITE_ROOT = %(WEEWX_ROOT)s/archive" will become simply
> "SQLITE_ROOT = archive".  however, if weewx is going to be backward
> compatible, then it will still have to do expansion of WEEWX_ROOT when it
> finds %(WEEWX_ROOT)s...
>

As always, WEEWX_ROOT is defined at the top of weewx.conf. So, for a V4.9
weewx.conf it becomes /home/weewx//home/weewx/archive, which is equivalent
to /home/weewx/archive. For V5.0, it becomes ~/weewx-data/archive.

2) are SKIN_ROOT and HTML_ROOT also relative to WEEWX_ROOT? (but only if
> they are a relative path)
>

Yes. They've always been that way.

> 3) where do the local, html-ified weewx docs live on a pip install?
>

$WEEWX_ROOT/$HTML_ROOT, which becomes /home/weewx/public_html for a v4.9
install, ~/weewx-data/public_html for a V5 install.

Hope that answers everything.

-tk

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/CAPq0zEA60XqLZRLxN%2BsXhjGX8Z4NT04n%2B9Mh3mRaGZB3wfz_jQ%40mail.gmail.com.

Reply via email to