Roundup Tracker - Issues

Issue 2550995

classification
KeyError classic during roundup-admin install
Type: behavior Severity: normal
Components: Installation Versions: 2.1.0
process
Status: fixed fixed
:
: : austin, rouilj, tonimueller
Priority: : OS-OSX

Created on 2018-08-22 10:24 by austin, last changed 2022-07-09 22:18 by rouilj.

Messages
msg6216 Author: [hidden] (austin) Date: 2018-08-22 10:24
WangXus-MacBook-Pro:trackers wangxu$ sudo roundup-admin  install
Password:
Enter tracker home: /Users/wangxu/Documents/tmpwork/trackers/support
Templates::
Select template [classic]:
Back ends:: anydbm, mysql, sqlite
Select backend [anydbm]:
Traceback (most recent call last):
  File "/usr/local/bin/roundup-admin", line 3, in <module>
    run()
  File "/Library/Python/2.7/site-packages/roundup/scripts/roundup_admin.py", line 49, 
in run
    sys.exit(tool.main())
  File "/Library/Python/2.7/site-packages/roundup/admin.py", line 1635, in main
    ret = self.run_command(args)
  File "/Library/Python/2.7/site-packages/roundup/admin.py", line 1510, in 
run_command
    return self.do_install(self.tracker_home, args)
  File "/Library/Python/2.7/site-packages/roundup/admin.py", line 433, in do_install
    init.install(tracker_home, templates[template]['path'], settings=defns)
KeyError: 'classic'
msg6217 Author: [hidden] (austin) Date: 2018-08-22 10:25
It's MacOSX, the roundup was installed by "sudo pip install roundup"
msg6218 Author: [hidden] (rouilj) Date: 2018-08-22 21:53
Hi Austin:

Sorry you are having trouble with this.

In message <1534933469.16.0.56676864532.issue2550995@psf.upfronthosting.co.za>,
austin writes:
>WangXus-MacBook-Pro:trackers wangxu$ sudo roundup-admin  install
>Password:
>Enter tracker home: /Users/wangxu/Documents/tmpwork/trackers/support
>Templates::

This indicates that the templates were not properly installed.

How did you install roundup?

I am not sure where they get installed on a mac, but you should have
template directories in:

 /usr/share/roundup/templates/

where /usr is the prefix you used when installing roundup (or
installed roundup using pip IIRC).

You should see something like:

  $ roundup-admin install
  Enter tracker home: foo
  Templates:: responsive, devel, jinja2, minimal, classic
  Select template [classic]:
   ...

Note the list of templates.

Have a great day.
--
				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.
msg6220 Author: [hidden] (austin) Date: 2018-08-23 09:44
Thanks John for the detailed clarification. It's very helpful. I think I can fix it manually. 
Will try to install template manually.

I installed roundup using PIP. say
"sudo pip install roundup"

Looks like the template was not installed ( or installed in proper location) by this way.
msg6221 Author: [hidden] (rouilj) Date: 2018-08-23 12:48
Hi Austin:

In message <1535017486.68.0.56676864532.issue2550995@psf.upfronthosting.co.za>,
austin writes:
>austin added the comment:
>I installed roundup using PIP. say
>"sudo pip install roundup"
>
>Looks like the template was not installed ( or installed in proper
>location) by this way.

Try doing a find down your filesystem looking for files with the name:

   TEMPLATE-INFO.txt

if the templates were installed, that file should be present in the
template directories.

I'll try to get access to a mac and see if I can figure out what
happend here.

Also if you can send an email to roundup-users, somebody may be able
to debug/get a fix before I can get to it.

Have a great day.
msg6223 Author: [hidden] (austin) Date: 2018-08-30 07:36
Hi John, 

The file  TEMPLATE-INFO.txt and also the template directory was not installed after 
"pip install"


I managed to have it running by downloading the source code and run the demo.py.

Still working on how to config it.

THanks,
Austin
msg6701 Author: [hidden] (rouilj) Date: 2019-10-06 23:27
Austin, do you have any updates on this? Did you get roundup working?
msg6805 Author: [hidden] (rouilj) Date: 2019-11-09 01:54
Austin, ping did you resolve this?
msg6848 Author: [hidden] (rouilj) Date: 2019-12-22 22:50
No response and I wasn't able to duplicate on a mac.
msg7519 Author: [hidden] (tonimueller) Date: 2022-05-14 02:24
I stumbled across the same error. No template was included in my installation of Roundup, which I did in a virtualenv with "pip install roundup". I manually copied the ./share/roundup/templates folder from the source archive into the roundup folder inside the virtualenv, and modified admin.py as follows:

In line 317, it reads:

    for N in 2, 4, 5, 6:

I modified this to read:

    for N in 1, 2, 4, 5, 6:

Now, the folder 'share' will be found, and I can choose from any template.
msg7520 Author: [hidden] (tonimueller) Date: 2022-05-14 02:25
Upp'ing severity as it prevents installation of a tracker.
msg7521 Author: [hidden] (rouilj) Date: 2022-05-14 15:57
Hi Toni:

Thanks for reopening this, but I think it may be solved in
the repo. However let's get a little info first.

What OS are you on? Also version of Roundup and Python are
you seeing this with?

What command did you use to create the virtulenv:
virtualenv, venv, pythonX -m venv ...?

Also what is the path of your virtualenv?

Can you do a (1):

  find /path/to/virtualenv | grep TEMPLATE

and tell me where the templates are.

It sounds like you did this sequence (using /tools/roundup
as the virtualenv root):

  % virtualenv -p python3 /tools/roundup

which performs an install of 2.1.0 from pipy using wheel indicated by:

  % /tools/roundup/lib/python3.6/site-packages/roundup-2.1.0.dist-info/WHEEL

Then running the find (1) above shows:

   /tools/roundup/lib/python3.6/site-
packages/tools/roundup/share/roundup/templates/minimal/TEMPLATE-INFO.txt

along with TEMPLATE-INFO.txt for the other 4 templates. This
path will not be found by roundup as is not a parent
directory of admin.py followed by share/roundup/templates.

You placed the share subdirectory in the same directory as
admin.py. This is why you needed to patch admin.py to add 1.

If you place the share directory at the same level as the
bin directory in your virtualenv it should be found by
roundup-admin. (Also IIRC roundup will also use a locale
subdirectory for translations at that location.)

I was able to fix this (for 2.1.0) with:

  cp -pr /tools/roundup/lib/python3.6/site-packages/tools/roundup/share/. 
/tools/roundup/share/.

then roundup-admin install listed all the templates and
worked correctly.

This points to a couple of additional improvements:

  1) if no templates are found in listTemplates(), fail
     and report the lack of templates rather than crashing
     later in install.
     
  2) copying the files shouldn't be needed. But a symbolic
     link won't work as the check in listTemplates only
     allows a directory not a symbolic link to be
     scanned. So allow share to be a symbolic link.

Last novemeber changeset f961dbbc3573 was added which makes
roundup look in the wheel install directory.

Can you try the following:

  create a new virtualenv

  activate the virtualenv

  cd to a directory that is the current mercurial checkout of roundup
     (hg clone http://hg.code.sf.net/p/roundup/code roundup; cd roundup)

  run python ./setup.py sdist

  run pip install dist/roundup-2.1.0.tar.gz

The find above should show the templates in the wheel
location, but roundup-admin should now work.
msg7522 Author: [hidden] (tonimueller) Date: 2022-05-14 17:08
Hi John,
I'm on Debian 11.3 amd64, with Python 3.9.2 and virtualenv created by 'mkvirtualenv' (I use virtualenvwrapper). I use the standard path for virtualenvs, which is $HOME/.virtualenvs, and after my modification, the templates are now at

$HOME/.virtualenvs/roundup/lib/python3.9/site-packages/roundup/share/roundup/templates/classic/TEMPLATE-INFO.txt, and for the other templates respectively.

After creating the stuff you suggested, I end up with a virtualenv that looks like this, after installing roundup from mercurial:

$HOME/.virtualenv/roundup-test/lib/python3.9/site-packages$HOME/.virtualenvs/roundup-test/share/{locale,man,roundup/templates}, and under the 'templates' dir, I find the actual templates. At this point, roundup-admin does find the templates, but this directory structure does not look nice at all, at least not to my taste.
msg7523 Author: [hidden] (rouilj) Date: 2022-05-14 22:59
Hi Toni:

In message <1652548104.05.0.0846912440635.issue2550995@roundup.psfhosted.org>,
Toni Mueller writes:
>I'm on Debian 11.3 amd64, with Python 3.9.2 and virtualenv created by
>'mkvirtualenv' (I use virtualenvwrapper). I use the standard path for
>virtualenvs, which is $HOME/.virtualenvs, and after my modification,
> the templates are now at
>
>$HOME/.virtualenvs/roundup/lib/python3.9/site-packages/roundup/share/roundup/templates/classic/TEMPLATE-INFO.txt, and for the other templates respectively.

Thanks for the info. To support this layout, you would need to make
the code modification you posted.

It is not one that we recommend/support as putting the shared files
isn't something that is supported. We use whatever setuputils uses for
the installation. We used to use distutils and that had more
flexibility in where we put shared resources. But Distutils is
depricated (PEP 636) so....

>After creating the stuff you suggested, I end up with a virtualenv
>that looks like this, after installing roundup from mercurial:

> $HOME/.virtualenv/roundup-test/lib/python3.9/site-packages$HOME/.virtualenvs/roundup-test/share/{locale,man,roundup/templates},
>and under the 'templates' dir, I find the actual templates. At this
>point, roundup-admin does find the templates, but this directory
>structure does not look nice at all, at least not to my taste.

I agree its ugly and unwanted. However that structure is controlled by
setuputils with wheel installs and we have very few controls to change
it. See: https://discuss.python.org/t/should-there-be-a-new-standard-for-installing-arbitrary-data-files/7853/91

for more info.

Do you agree this issue can be closed?
msg7585 Author: [hidden] (rouilj) Date: 2022-06-27 03:13
Closing. The edits done for issue2551167 should have solved this.
Will be fixed in 2.2.0.
History
Date User Action Args
2022-07-09 22:18:08rouiljsetstatus: open -> fixed
resolution: abandoned -> fixed
2022-06-27 03:13:21rouiljsetmessages: + msg7585
2022-05-14 22:59:28rouiljsetmessages: + msg7523
title: KeyError classic during roundup-admin install -> KeyError classic during roundup-admin install
2022-05-14 17:08:24tonimuellersetmessages: + msg7522
2022-05-14 15:57:58rouiljsetmessages: + msg7521
2022-05-14 11:45:18tonimuellersetstatus: closed -> open
2022-05-14 02:25:36tonimuellersetmessages: + msg7520
severity: minor -> normal
2022-05-14 02:24:45tonimuellersetnosy: + tonimueller
messages: + msg7519
versions: + 2.1.0, - 1.6
2019-12-22 22:50:09rouiljsetstatus: new -> closed
resolution: abandoned
messages: + msg6848
2019-11-09 01:54:29rouiljsetmessages: + msg6805
2019-10-06 23:28:27rouiljsetkeywords: + OS-OSX
2019-10-06 23:27:05rouiljsetmessages: + msg6701
2018-08-30 07:36:36austinsetmessages: + msg6223
2018-08-23 12:48:55rouiljsetmessages: + msg6221
2018-08-23 09:44:46austinsetmessages: + msg6220
2018-08-22 21:53:00rouiljsetnosy: + rouilj
messages: + msg6218
2018-08-22 10:25:46austinsetmessages: + msg6217
2018-08-22 10:24:29austincreate