Scripts path manipulation doesn't work for Ubuntu system wide installs
Doesn't take account of use of dist-packages in place of site-packages.
Comments (23)
-
reporter -
reporter Tested using ubuntu virtualenv install. rdsr script doesn't attempt to do anything to the path, but relies on site-packages or dist-packages being on the python path so that openrem.remapp.extractors.rdsr can be imported. rdsr.py now sets the DJANGO_SETTINGS_MODULE to openrem.openrem.settings instead of openrem.settings, and doesn't make use of the name_of_project function, which is no longer relevant as openrem is packaged as the application rather than remapp. Needs testing outside of virtualenv on Ubuntu, and in and out on Windows. Other scripts need to be changed in the same way. Refs
#99.→ <<cset b06f914db404>>
-
reporter openrem_settings still needed to put the openrem folder on the path to allow
from remapp.models import General_study_module_attributes
else that would have to be changed to
openrem.remapp.models
throughout. -
reporter Made necessary changes to mam.py and ct_philips.py. Left ptsizecsv2db.py for now as the develop version has changed too significantly since this branch was created, so this needs to be done after the merge. Refs
#99.→ <<cset e9eb89729517>>
-
reporter Proposed fix for ref issue
#99for all but ptsizecsv2db. Needs to be merfed into develop for testing. ptsizecsv2db to be edited once merged.→ <<cset 052b0641f14d>>
-
reporter Removed name_of_project function as it is now not called following ref
#99modifications.→ <<cset 4099afd9cb4c>>
-
reporter - changed status to resolved
Changed ptsizecsv2db in line with the extractor functions to call openrem.openrem.settings directly. Subject to testing, should fix
#99.→ <<cset 6720e0b2209e>>
-
reporter Added ref
#99to the changes file.→ <<cset 49fb2561948f>>
-
reporter Added windows line endings to import logs (ref
#117), hopefully fixed issue#99, lots of improvements to the install and upgrade docs.→ <<cset 4e0c16f047af>>
-
reporter - changed status to open
Doesn't quite work on Ubuntu. Fails to import the local_settings.
-
reporter Updated with possible fix in commit 6b6219c - forgot to add ref to issue.
-
reporter Tested import modifications on Ubuntu 14.04.1 system wide pip install and in a virtualenv. Need to test in Windows.
-
reporter Testing in a virtualenv in Windows was very confusing as the python path seemed to include the system site-packages :-(
Once that was sorted it out, the proposed changes didn't quite work for the extractors:
- If the openrem folder is put on the path and
DJANGO_SETTINGS_MODULE
is set toopenrem.openrem.settings
from django.db import models
will failfrom remapp.models import General_study_module_attributes
will succeed
- If the openrem folder is not put on the path and
DJANGO_SETTINGS_MODULE
is set toopenrem.openrem.settings
from django.db import models
will succeedfrom remapp.models import General_study_module_attributes
will fail
- If the openrem folder is put on the path and
DJANGO_SETTINGS_MODULE
is set toopenrem.settings
from django.db import models
will succeedfrom remapp.models import General_study_module_attributes
will succeed
I now need to see if this configuration works for Ubuntu system install and linux virtualenv installs.
- If the openrem folder is put on the path and
-
reporter Modified rdsr.py to set the DJANGO_SETTINGS_MODULE to openrem.settings as the project folder is on the path, and in the Windows virtualenv openrem.openrem.settings failed to import if the project was on the path. Refs
#99.→ <<cset 042d912e8239>>
-
reporter The format that worked for rdsr in a virtualenv on Windows doesn't work for Ubuntu in a virtual machine. django.db requires openren.openrem.settings, even with the project on the path. Tried adding a try except Import Error but it failed somewhere in the remapp.models. Settled on setting DJANGO_SETTINGS_MODULE to openrem.openrem.settings and importing django.db.models, then adding the projec to the path and importing rempapp.models.General_study_module_attributes. Needs testing in Windows again. Refs
#99.→ <<cset 6d8a7f75dad8>>
-
reporter Tested in Windows using a virtualenv. Now established that for Windows virtualenv:
- Must call python to get the virtualenv version rather than the system version
- Scripts do have path to virtualenv python, but it is ignored
In terms of the change to setting the
DJANGO_SETTINGS_MODULE
and importingdjango.models
before putting the project on the path and importingremapp.models
, that seemed to work.Now need to test with system wide installs on Windows and Ubuntu, and make the same edits to the other extractor files.
-
reporter Works for a system wide Ubuntu install
-
reporter Works for Windows system wide installs
-
reporter - changed status to resolved
-
reporter - changed status to open
-
reporter Moving adding of project to path from before setting the
DJANGO_SETTINGS_MODULE
to afterwards. Refs#99.→ <<cset 39fb290a4943>>
-
reporter - changed status to resolved
Fixes issue
#99by importing in an order that works for Windows and Ubuntu system wide installs, and for Windows and Ubuntu virtualenv installs.→ <<cset 66188af572d5>>
-
reporter Adding findings from ref issue
#99regarding using virtualenv with Windows.→ <<cset 82425dd3e5dd>>
- Log in to comment
Removed the sys.path manipulation code from the import scripts again, as per 70888d1 and ref
#73. This was reverted in fce9dd302bda and 15001b9222dd for#83due to extraction scripts not functioning in virtualenv on linux. The existing code wouldn't work with debian installs due to assumption of site-packages instead of dist-packages. However, it seems that the correct thing to do would be to do: from openrem.remapp.extractors import rdsr, hence this commit. I think this will then break the openrem.settings finding, but this should be dealt with in the extractor codes, not here. We'll probably need to set the DJANGO_SETTINGS_MODULE to openrem.openrem.settings and then we'll not need the openrem_settings code at all. Refs#99.→ <<cset 4220f2d82b54>>