Add patch for python 3 support, use python3 for createmodule.py on F22
This commit is contained in:
parent
c5ce4a52cb
commit
6dacb3a2a8
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import os,sys,re
|
import os,sys,re
|
||||||
@ -41,13 +42,13 @@ def getenv(cmd = ':'):
|
|||||||
p = Popen(cmd + ";env", shell=True, stdout=PIPE, stderr=PIPE)
|
p = Popen(cmd + ";env", shell=True, stdout=PIPE, stderr=PIPE)
|
||||||
(stdout, stderr) = p.communicate()
|
(stdout, stderr) = p.communicate()
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
print "EROR: Could not execute initscript:"
|
print("EROR: Could not execute initscript:")
|
||||||
print "%s returned exit code %d" % (cmd, p.returncode)
|
print("%s returned exit code %d" % (cmd, p.returncode))
|
||||||
print stderr
|
print(stderr)
|
||||||
exit(1)
|
exit(1)
|
||||||
if stderr != '':
|
if stderr != '':
|
||||||
print "WARNING: initscript sent the following to stderr:"
|
print("WARNING: initscript sent the following to stderr:")
|
||||||
print stderr
|
print(stderr)
|
||||||
# Parse the output key=value pairs
|
# Parse the output key=value pairs
|
||||||
skip = False
|
skip = False
|
||||||
for line in stdout.splitlines():
|
for line in stdout.splitlines():
|
||||||
@ -58,8 +59,8 @@ def getenv(cmd = ':'):
|
|||||||
try:
|
try:
|
||||||
(var,value) = line.split('=',1)
|
(var,value) = line.split('=',1)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print "ERROR: Could not parse output line:"
|
print("ERROR: Could not parse output line:")
|
||||||
print line
|
print(line)
|
||||||
exit(1)
|
exit(1)
|
||||||
# Exported functions - not handled
|
# Exported functions - not handled
|
||||||
if value.find('() {') == 0:
|
if value.find('() {') == 0:
|
||||||
@ -149,30 +150,30 @@ elif not options.noprefix:
|
|||||||
prefix = None
|
prefix = None
|
||||||
|
|
||||||
# Print out the modulefile
|
# Print out the modulefile
|
||||||
print "#%Module 1.0"
|
print("#%Module 1.0")
|
||||||
|
|
||||||
# Prefix
|
# Prefix
|
||||||
if prefix is not None:
|
if prefix is not None:
|
||||||
print "\nset prefix " + prefix + "\n"
|
print("\nset prefix " + prefix + "\n")
|
||||||
|
|
||||||
# Chdir
|
# Chdir
|
||||||
if chdir is not None:
|
if chdir is not None:
|
||||||
print "chdir\t" + chdir
|
print("chdir\t" + chdir)
|
||||||
|
|
||||||
# Function to format output line with tabs and substituting prefix
|
# Function to format output line with tabs and substituting prefix
|
||||||
def formatline(item, key, value=None):
|
def formatline(item, key, value=None):
|
||||||
print item,
|
print(item, end=' ')
|
||||||
print "\t"*(2-(len(item)+1)/8),
|
print("\t"*(2-(len(item)+1)/8), end=' ')
|
||||||
print key,
|
print(key, end=' ')
|
||||||
if value is not None:
|
if value is not None:
|
||||||
print "\t"*(3-(len(key)+1)/8),
|
print("\t"*(3-(len(key)+1)/8), end=' ')
|
||||||
if prefix is not None:
|
if prefix is not None:
|
||||||
print value.replace(prefix,'$prefix')
|
print(value.replace(prefix,'$prefix'))
|
||||||
else:
|
else:
|
||||||
print value
|
print(value)
|
||||||
|
|
||||||
# Paths first, grouped by variable name
|
# Paths first, grouped by variable name
|
||||||
pathkeys = appendpath.keys() + prependpath.keys()
|
pathkeys = list(appendpath.keys()) + list(prependpath.keys())
|
||||||
pathkeys.sort()
|
pathkeys.sort()
|
||||||
for key in pathkeys:
|
for key in pathkeys:
|
||||||
if key in prependpath:
|
if key in prependpath:
|
||||||
@ -181,16 +182,16 @@ for key in pathkeys:
|
|||||||
formatline("append-path",key,appendpath[key])
|
formatline("append-path",key,appendpath[key])
|
||||||
|
|
||||||
# Setenv
|
# Setenv
|
||||||
setenvkeys = setenv.keys()
|
setenvkeys = list(setenv.keys())
|
||||||
setenvkeys.sort()
|
setenvkeys.sort()
|
||||||
if setenvkeys:
|
if setenvkeys:
|
||||||
print
|
print()
|
||||||
for key in setenvkeys:
|
for key in setenvkeys:
|
||||||
formatline("setenv",key,setenv[key])
|
formatline("setenv",key,setenv[key])
|
||||||
|
|
||||||
# Unsetenv
|
# Unsetenv
|
||||||
unsetenv.sort()
|
unsetenv.sort()
|
||||||
if unsetenv:
|
if unsetenv:
|
||||||
print
|
print()
|
||||||
for key in unsetenv:
|
for key in unsetenv:
|
||||||
formatline("unsetenv",key)
|
formatline("unsetenv",key)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: environment-modules
|
Name: environment-modules
|
||||||
Version: 3.2.10
|
Version: 3.2.10
|
||||||
Release: 12%{?dist}
|
Release: 13%{?dist}
|
||||||
Summary: Provides dynamic modification of a user's environment
|
Summary: Provides dynamic modification of a user's environment
|
||||||
|
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
@ -29,6 +29,10 @@ Patch4: environment-modules-format.patch
|
|||||||
# Support Tcl 8.6
|
# Support Tcl 8.6
|
||||||
# https://sourceforge.net/p/modules/feature-requests/14/
|
# https://sourceforge.net/p/modules/feature-requests/14/
|
||||||
Patch5: environment-modules-tcl86.patch
|
Patch5: environment-modules-tcl86.patch
|
||||||
|
# python 3 support
|
||||||
|
# https://sourceforge.net/p/modules/patches/15/
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1184979
|
||||||
|
Patch6: environment-modules-py3-and-doc-fix.patch
|
||||||
|
|
||||||
BuildRequires: tcl-devel, tclx-devel, libX11-devel
|
BuildRequires: tcl-devel, tclx-devel, libX11-devel
|
||||||
BuildRequires: dejagnu
|
BuildRequires: dejagnu
|
||||||
@ -72,6 +76,7 @@ have access to the module alias.
|
|||||||
%patch3 -p1 -b .avail
|
%patch3 -p1 -b .avail
|
||||||
%patch4 -p1 -b .format
|
%patch4 -p1 -b .format
|
||||||
%patch5 -p1 -b .tcl86
|
%patch5 -p1 -b .tcl86
|
||||||
|
%patch6 -p1 -b .py3
|
||||||
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
@ -90,6 +95,10 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
|
|||||||
touch %{buildroot}%{_sysconfdir}/profile.d/modules.{csh,sh}
|
touch %{buildroot}%{_sysconfdir}/profile.d/modules.{csh,sh}
|
||||||
cp -p %SOURCE1 $RPM_BUILD_ROOT%{_datadir}/Modules/init/modules.sh
|
cp -p %SOURCE1 $RPM_BUILD_ROOT%{_datadir}/Modules/init/modules.sh
|
||||||
cp -p %SOURCE2 %SOURCE3 $RPM_BUILD_ROOT%{_datadir}/Modules/bin
|
cp -p %SOURCE2 %SOURCE3 $RPM_BUILD_ROOT%{_datadir}/Modules/bin
|
||||||
|
%if 0%{?fedora} >= 22
|
||||||
|
sed -i -e 1s,/usr/bin/python,/usr/bin/python3, \
|
||||||
|
$RPM_BUILD_ROOT%{_datadir}/Modules/bin/createmodule.py
|
||||||
|
%endif
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modulefiles \
|
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modulefiles \
|
||||||
$RPM_BUILD_ROOT%{_datadir}/modulefiles
|
$RPM_BUILD_ROOT%{_datadir}/modulefiles
|
||||||
# Install the rpm config file
|
# Install the rpm config file
|
||||||
@ -131,6 +140,9 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jan 28 2015 Orion Poplwski <orion@cora.nwra.com> - 3.2.10-13
|
||||||
|
- Add patch for python 3 support, use python3 for createmodule.py on F22
|
||||||
|
|
||||||
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.10-12
|
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2.10-12
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user