eftsung / pygr

Automatically exported from code.google.com/p/pygr
0 stars 0 forks source link

patch: correctly identify user's MySQL config file on Windows #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This patches sqlgraph.py to find my.ini or my.cnf under WINDIR and SYSTEMDRIVE.

Original issue reported on code.google.com by the.good...@gmail.com on 21 Jun 2008 at 8:52

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by the.good...@gmail.com on 22 Aug 2008 at 4:52

GoogleCodeExporter commented 8 years ago

Original comment by mare...@gmail.com on 21 Feb 2009 at 2:02

GoogleCodeExporter commented 8 years ago
I think this patch is not good and I think the original mode of operation is
suboptimal as well.

It would be much simpler if, for running test, one would be required to place a 
copy
of the my.cnf file in the test directory and the system would read that. I find 
it
very troubling that just by downloading pygr and running the tests the system 
will
start hammering away on a database without making the user aware of this. At 
the same
time it makes it impossible to set up a test database for testing, and one for 
work,
as the approach will use whatever is activated.

As for the patch itself

1. first there is a lot of code duplication in there, those could be 
consolidated
into a single loop over names
2. moreover it does not deal with the case when mysqldb is installed and the 
test is
triggered but the config file is not actually present, the conditional will 
just fall
off the end leaving configFile=None

Original comment by istvan.a...@gmail.com on 21 Feb 2009 at 3:50

GoogleCodeExporter commented 8 years ago
Hi Alex,
please verify the fix to this bug that you reported, and then change its status 
to
Closed.  Istvan rewrote the Windows my.cnf detection code recently.  We are now
requiring that each fix be verified by someone other than the developer who 
made the fix.

Thanks!

Chris

Original comment by cjlee...@gmail.com on 4 Mar 2009 at 11:08

GoogleCodeExporter commented 8 years ago

Original comment by mare...@gmail.com on 13 Mar 2009 at 12:55

GoogleCodeExporter commented 8 years ago
I have verified that Istvan's code correctly locates MySQL config files in 
%WINDIR% 
and %SYSTEMDRIVE%, i.e. that it addresses the issue raised by Alex. However, it 
relies on $HOME to be set in order to use the one in user's home directory; 
this is 
not portable, os.path.expanduser('~') should be used instead. Example, quoted 
verbatim from a Python 2.5.4 session on an XP SP3 box:

>>> import os
>>> print os.environ.get('HOME')
None
>>> print os.path.expanduser('~')
C:\Documents and Settings\myuser
>>>

Attached you will find a patch which corrects this, thus making it possible to 
use .my.cnf from the user's home directory under Windows. Please commit to 
master.

Original comment by mare...@gmail.com on 8 Apr 2009 at 2:27

Attachments:

GoogleCodeExporter commented 8 years ago
Checked into the master by Chris, closing the issue.

Original comment by mare...@gmail.com on 8 Apr 2009 at 8:36