openmolar looking in /usr/share/openmolar

  • Done
  • quality assurance status badge
Details
4 participants
  • Adonay Felipe Nogueira
  • Chris Marusich
  • Ludovic Courtès
  • Quiliro Ordonez Baca
Owner
unassigned
Submitted by
Quiliro Ordonez Baca
Severity
normal
Q
Q
Quiliro Ordonez Baca wrote on 20 Nov 2017 18:33
(address . bug-guix@gnu.org)
878tf0x3bq.fsf@riseup.net
When starting OpenMolar for the first time, it has an error when it
creates the application database:

ERROR - error creating database tables
Traceback (most recent call last):
File "/gnu/store/smx5rayf45ylqn59czjkvx2hcrl95p5x-openmolar-1.0.15-gd81f9e5/lib/python3.5/site-packages/openmolar/create_db.py", line 145, in create_tables
f = open(fp, "r")
FileNotFoundError: [Errno 2] No existe el fichero o el directorio: '/usr/share/openmolar/resources/schema.sql'

when it should look for the following file:
/gnu/store/smx5rayf45ylqn59czjkvx2hcrl95p5x-openmolar-1.0.15-gd81f9e5/share/openmolar/resources/schema.sql

The flaw in the definition is in:
/gnu/store/smx5rayf45ylqn59czjkvx2hcrl95p5x-openmolar-1.0.15-gd81f9e5/lib/python3.5/site-packages/openmolar/settings/localsettings.py: SHARE_DIR = os.path.join("/usr", "share", "openmolar")

I do not know haw to fix it. Please instruct how to do it.
L
L
Ludovic Courtès wrote on 21 Nov 2017 14:38
control message for bug #29365
(address . control@debbugs.gnu.org)
87wp2jlpkk.fsf@gnu.org
tags 29365 easy
C
C
Chris Marusich wrote on 22 Nov 2017 10:35
Re: bug#29365: openmolar looking in /usr/share/openmolar
(name . Quiliro Ordonez Baca)(address . quiliro@riseup.net)(address . 29365@debbugs.gnu.org)
87tvxmfyf4.fsf@gmail.com
Quiliro Ordonez Baca <quiliro@riseup.net> writes:

Toggle quote (17 lines)
> When starting OpenMolar for the first time, it has an error when it
> creates the application database:
>
> ERROR - error creating database tables
> Traceback (most recent call last):
> File "/gnu/store/smx5rayf45ylqn59czjkvx2hcrl95p5x-openmolar-1.0.15-gd81f9e5/lib/python3.5/site-packages/openmolar/create_db.py", line 145, in create_tables
> f = open(fp, "r")
> FileNotFoundError: [Errno 2] No existe el fichero o el directorio: '/usr/share/openmolar/resources/schema.sql'
>
> when it should look for the following file:
> /gnu/store/smx5rayf45ylqn59czjkvx2hcrl95p5x-openmolar-1.0.15-gd81f9e5/share/openmolar/resources/schema.sql
>
> The flaw in the definition is in:
> /gnu/store/smx5rayf45ylqn59czjkvx2hcrl95p5x-openmolar-1.0.15-gd81f9e5/lib/python3.5/site-packages/openmolar/settings/localsettings.py: SHARE_DIR = os.path.join("/usr", "share", "openmolar")
>
> I do not know haw to fix it. Please instruct how to do it.

Based on your assessment, it looks like the problem is that the
application hard-codes the "/usr" directory path.

One solution for this problem is to replace that line of code in the
source with the correct path. You can do this in the package definition
by using the substitute* macro provided by the (guix build utils)
module. In fact, it looks like the current package definition for
openmolar already attempts to do this. Run "guix edit openmolar" to
view the current package definition.

Perhaps you could modify the package definition to also replace the path
in localsettings.py? You might also want to look around in the source
for other paths that need to be fixed (a command such as "grep -r /usr"
might be helpful).

For information on how to use substitute*, please refer to
guix/build/utils.scm in the Guix source tree. For general information
on hacking on Guix, check the section titled "Contributing" in the
manual (e.g., run info '(guix) Contributing' in a terminal).

--
Chris
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEy/WXVcvn5+/vGD+x3UCaFdgiRp0FAloVRP8ACgkQ3UCaFdgi
Rp0XHQ/+MsO3l1tD8gWgduSkrYQF9vNWSH1IQ2RqVQlQudCO9ovYIijVDPw5Px0X
0+4RG+HmuskhRapeTxFvBHtao4Z8nGoRDJf0vsdYA3qquAZMtPmrBWcsBxLAdcg7
TbwphntIYEvfyyETbcl2Kd8q7S/5ateXAu4h3Mm3cKK5xA1rsnJ7+xM84dMah3db
YXj4nNzjNwYt7Qg7zC3gEjR1VookUI7IfROSOf8dRbWh4L8fqTmpJoVZorQWNDS7
iLPL0g4i/WaYitfrvrXm53h41rkFWADLseAe/hb89iZuePxGXFdOLCdyLQW2COI0
HELsIAnQ3/EJ3moGY9ou05IGf38eO9KDah1dQ2Co38ACLu+V8Dp4DB9SzeiMzWDk
kq5GHJsFmJQ1I9Ex0MsS0cjkA/jUCT3hFr2jI9ST5tIThro/hc1o23XxoHt5kXC8
zu5G/HwGOKrpinZgHIay4J3Tey/eqSJuOlmNBQYhOFRooaEiUUfMNO3swbBrJ+H4
T/dsL8VyNXjIrzvVCQ93jzkLbzX//vbxPqDwfxOhcvKVSqGE8S+7bzBysrbxY/6y
LOSMk8McVsTE07UaHyZxZZCy9ZngRWYMUnxamQx6HG4b4bTPqk1MkKjzehw97wpb
kC4uMJ1UEpPkRyncmQPIJmeEt/S+JZCb+Rs2qR2FTPmnZIdLUKY=
=tleE
-----END PGP SIGNATURE-----

A
A
Adonay Felipe Nogueira wrote on 22 Nov 2017 18:13
(address . 29365@debbugs.gnu.org)
871skq2q4j.fsf@hyperbola.info
Adding to what Chris Marusich described:

'substitute* works somewhat in the following way:

Toggle snippet (5 lines)
(substitute FILE-string-or-FILE-list-of-strings
((EREGEX-string SYMBOLS-to-put-both-entire-match-and-captures-or-NOTHING)
REPLACEMENT-string))

For example:

Toggle snippet (27 lines)
(substitute "file1.txt"
(("a")
"b")
;; ... would replace every "a" with "b".
(("1([[:digit:]]*)([^[:digit:]])" full capture1 capture2)
(string-append full
" 2"
capture1
capture2)))
;; ... would replace "1234A" and "1A" with "1234A 2234A" and "1A 2A",
;; respectively.

(substitute '("file2.txt"
"file3.txt"
"file4.txt")
(("a\\*\n") ; matches literal asterisk (*) followed by a new
; line/line feed.
"b")
;; ... from "a*[newline]" to "b".
(("(1)[^[:digit:]]*" _ interesting-one) ; use "_" capture to not save
; the whole match.
(string-append interesting-one
" 1")))
;; ... from "1A" or from "1ABC" to "1 1" ("A" and "ABC" parts are
;; discarded).

Notice that the regular expression that GNU Guile uses is the extended
one (Extended Regular Expression). See the info page for Guile for more
details (type `info guile' in the terminal, and go to the section
"Regular Expressions", inside that section notice that there is one
talking about backslash escapes, this one is also important for reasons
that you'll see in the next paragrah).

Notice that in Guile backslashes in strings also have special meaning,
so one has to take into account string+regex special meaning when doing
backslash escapes. In the examples given, the replacement for
"file2.txt" onwards shows us how to deal with this.

I hope this helps! ;)

2017-11-22T01:35:59-0800 Chris Marusich wrote:
Toggle quote (21 lines)
>
> Based on your assessment, it looks like the problem is that the
> application hard-codes the "/usr" directory path.
>
> One solution for this problem is to replace that line of code in the
> source with the correct path. You can do this in the package definition
> by using the substitute* macro provided by the (guix build utils)
> module. In fact, it looks like the current package definition for
> openmolar already attempts to do this. Run "guix edit openmolar" to
> view the current package definition.
>
> Perhaps you could modify the package definition to also replace the path
> in localsettings.py? You might also want to look around in the source
> for other paths that need to be fixed (a command such as "grep -r /usr"
> might be helpful).
>
> For information on how to use substitute*, please refer to
> guix/build/utils.scm in the Guix source tree. For general information
> on hacking on Guix, check the section titled "Contributing" in the
> manual (e.g., run info '(guix) Contributing' in a terminal).

--
- Palestrante e consultor sobre /software/ livre (não confundir com
gratis).
- "WhatsApp"? Ele não é livre. Por favor, veja formas de se comunicar
instantaneamente comigo no endereço abaixo.
- Arquivos comuns aceitos (apenas sem DRM): Corel Draw, Microsoft
Office, MP3, MP4, WMA, WMV.
- Arquivos comuns aceitos e enviados: CSV, GNU Dia, GNU Emacs Org, GNU
GIMP, Inkscape SVG, JPG, LibreOffice (padrão ODF), OGG, OPUS, PDF
(apenas sem DRM), PNG, TXT, WEBM.
Q
Q
Quiliro Ordonez Baca wrote on 20 Dec 2017 21:11
(name . Chris Marusich)(address . cmmarusich@gmail.com)(address . 29365@debbugs.gnu.org)
87po79rwgb.fsf@portkomputilo.i-did-not-set--mail-host-address--so-tickle-me
Chris Marusich <cmmarusich@gmail.com> writes:

Toggle quote (22 lines)
> Quiliro Ordonez Baca <quiliro@riseup.net> writes:
>
>> When starting OpenMolar for the first time, it has an error when it
>> creates the application database:
>>
>> ERROR - error creating database tables
>> Traceback (most recent call last):
>> File "/gnu/store/smx5rayf45ylqn59czjkvx2hcrl95p5x-openmolar-1.0.15-gd81f9e5/lib/python3.5/site-packages/openmolar/create_db.py", line 145, in create_tables
>> f = open(fp, "r")
>> FileNotFoundError: [Errno 2] No existe el fichero o el directorio: '/usr/share/openmolar/resources/schema.sql'
>>
>> when it should look for the following file:
>> /gnu/store/smx5rayf45ylqn59czjkvx2hcrl95p5x-openmolar-1.0.15-gd81f9e5/share/openmolar/resources/schema.sql
>>
>> The flaw in the definition is in:
>> /gnu/store/smx5rayf45ylqn59czjkvx2hcrl95p5x-openmolar-1.0.15-gd81f9e5/lib/python3.5/site-packages/openmolar/settings/localsettings.py: SHARE_DIR = os.path.join("/usr", "share", "openmolar")
>>
>> I do not know haw to fix it. Please instruct how to do it.
>
> Based on your assessment, it looks like the problem is that the
> application hard-codes the "/usr" directory path.

Yes.

Toggle quote (7 lines)
> One solution for this problem is to replace that line of code in the
> source with the correct path. You can do this in the package definition
> by using the substitute* macro provided by the (guix build utils)
> module. In fact, it looks like the current package definition for
> openmolar already attempts to do this. Run "guix edit openmolar" to
> view the current package definition.

Exactly. It already attempts to do that in:

(arguments
`(#:use-setuptools? #f
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-/usr
(lambda* (#:key outputs #:allow-other-keys)
(substitute* "setup.py"
(("/usr") (assoc-ref outputs "out")))
#t)))))

Toggle quote (5 lines)
> Perhaps you could modify the package definition to also replace the path
> in localsettings.py? You might also want to look around in the source
> for other paths that need to be fixed (a command such as "grep -r /usr"
> might be helpful).

$ grep -R /usr
lib/python3.5/site-packages/openmolar/dbtools/records_in_use.py:#! /usr/bin/env p
lib/python3.5/site-packages/openmolar/settings/localsettings.py: SHARE_DIR = os.path.join("/usr", "share", "openmolar")
Coincidencia en el fichero binario lib/python3.5/site-packages/openmolar/settings/__pycache__/localsettings.cpython-35.pyc

openmolar has three dependencies:
python-pyqt+sqcintilla
python-mysqlclient
qscintilla

But only python-pyqt+sqcintilla files have /usr on them (besides openmolar's). Perhaps the
problem is that package definition. But I cannot figure how to do it yet.

Toggle quote (5 lines)
> For information on how to use substitute*, please refer to
> guix/build/utils.scm in the Guix source tree. For general information
> on hacking on Guix, check the section titled "Contributing" in the
> manual (e.g., run info '(guix) Contributing' in a terminal).

I find that it is needed to download the source. But I do not have a
connection to the web. I have to travel 1 hour every time I need to
connect. Is there any way i can use Emacs to have all necesary files for
hacking on Guix?
L
L
Ludovic Courtès wrote on 10 Feb 22:56 +0100
Re: [bug#68720] [PATCH] gnu: openmolar-1: Update to release 1.1.6-g81838c8 and partial runtime fix.
(name . Marco Rimoldi)(address . rimarko@libero.it)
87y1bsgf0s.fsf@gnu.org
Hi,

Marco Rimoldi <rimarko@libero.it> skribis:

Toggle quote (2 lines)
Alright, applied!

Toggle quote (8 lines)
> The package now fails to start with this error message:
>
> File "/gnu/store/zzys4bqllx3a3gramwj2pyyigfb4z75b-openmolar-1.1.6-g81838c85/lib/python3.10/site-packages/openmolar/qt4gui/customwidgets/toothProps.py", line 827, in shapes
> self.mesial.setPoints(
> TypeError: 'float' object cannot be interpreted as an integer
>
> I will submit a new issue if the patch is accepted.

That’d be great.

Thanks!

Ludo’.
Closed
?