Project

General

Profile

Bug #14406

Part of the migration scripts are broken after moving them into directories

Added by Gianluca Petrillo almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Other
Target version:
-
Start date:
11/04/2016
Due date:
% Done:

100%

Estimated time:
2.00 h
Spent time:
Occurs In:
Experiment:
-
Co-Assignees:
Duration:

Description

With the move of migration scripts into ${LARSOFT_DIR}/bin subdirectories on LArSoft 6.11 (larsoft:d2e0b4494d7b939216494a3485ce622d0da359cb):

  1. moved scripts are not available via PATH: users have to find the scripts and specify the full path
  2. python scripts which use SerialSubstitution.py library fail to find it

The first point may be "solved" by updating the documentation, as it is not reasonable to pollute PATH list with the subdirectories.
The second point needs to be investigated. Either a programmatic solution is found, or a copy or symbolic link of the library must be stored with each python script.

History

#1 Updated by Lynn Garren almost 4 years ago

Are all scripts still needed?

#2 Updated by Lynn Garren almost 4 years ago

  • Status changed from New to Assigned
  • Assignee set to Lynn Garren

Append LARSOFT_DIR/bin to PYTHONPATH. Gianluca will verify that this is sufficient.

The instructions will be modified.

#3 Updated by Gianluca Petrillo almost 4 years ago

Adding ${LARSOFT_DIR}/bin to PYTHONPATH solves the issue.
Programmatic lookup is also possible:

import sys, os
try:
  LArSoftLibPath = os.path.join(os.environ['LARSOFT_DIR'], 'bin')
  if (os.path.isdir(LArSoftLibPath)): sys.path.insert(1, LArSoftLibPath)
except KeyError: pass
but it is an inferior solution in terms of maintainability, requiring to change the scripts at every reorganisation (which we love to do often).

My recommendation is to create a ${LARSOFT_DIR}/python directory where to put python libraries, and add that to PYTHONPATH.
The ${LARSOFT_DIR}/bin directory (and subdirectories) would contain only the end-user scripts.

#4 Updated by Lynn Garren almost 4 years ago

This is a workable solution.

#5 Updated by Lynn Garren almost 4 years ago

  • % Done changed from 0 to 80
  • Estimated time set to 2.00 h

Changes are in larsoft develop ready for the next release. The python directory is $LARSOFT_DIR/bin/python

#6 Updated by Lynn Garren over 3 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 80 to 100

This change was implemented in larsoft v06_17_00.

#7 Updated by Lynn Garren over 3 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF