nansat icon indicating copy to clipboard operation
nansat copied to clipboard

setup.py and perl scripts in mapper_ncep_wind_online.py

Open mortenwh opened this issue 10 years ago • 6 comments

This is related to a comment in #87. There seems to be a problem with installing the perl scripts used for mapper_ncep_wind_online.py with python setup.py install. The scripts are copied to the right folder in site-packages but are not executable and therefore fails. So... 1: Is there a way to make them executable by adding som lines to setup.py, or... 2: Do we have to make python methods, e.g., in the mapper?

mortenwh avatar Aug 26 '14 11:08 mortenwh

These Perl-scripts are stored in the same folder as the mappers, and thus do not need to be "installed"? In my case they are already executable (-rwxrwxr-x).

These two Perl-scripts are obtained from NOAA for subsetting of Grib-files. Ideally they should be re-written to Python for consistency, but that would take some effort by someone.

knutfrode avatar Aug 26 '14 11:08 knutfrode

Yes, the scripts seem to work when nansat is installed as python build_ext --inplace but with the regular python setup.py install the mapper fails because the perl scripts (now in the nansat version in site-packages) aren't executable. I hope the first option above is possible without too much "hacking"...

mortenwh avatar Aug 26 '14 12:08 mortenwh

Ok, I see. I have minimal experience with setup.py install, but assume it should be possible to make these scripts executable, or/and place them in the same folder as the mappers (from which they are called). If not, this should encourage re-writing them to Python.

knutfrode avatar Aug 26 '14 12:08 knutfrode

May 'Replacing Older Functions with the subprocess Module' help? https://docs.python.org/2/library/subprocess.html#subprocess-replacements

akorosov avatar Sep 04 '14 14:09 akorosov

@knutfrode , can you test if you can use subprocess instead of os.system()? maybe that will help to solve the issue?

akorosov avatar Sep 19 '14 08:09 akorosov

@akorosov That wouldn't change anything. Please have a look around if with setuptools you can make files executable on install. The long-term and cross-platform solution would be to rewrite the perl scripts in pure Python and don't use any system calls to linux tools.

letmaik avatar Sep 19 '14 08:09 letmaik