Skip to content

Commit 6404fd0

Browse files
committed
Makefile and spec file changes to build with Python 3/RHEL 8
1 parent e51d6a3 commit 6404fd0

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ VERSION := 3.0.0
1313
# Other configuration: May need to change for a release
1414
# ------------------------------------------------------------------------------
1515

16+
PYTHON = python
17+
1618
SBIN_FILES := osg-test osg-test-log-viewer
1719
INSTALL_SBIN_DIR := usr/sbin
1820

@@ -50,7 +52,7 @@ TARBALL_DIR := $(PACKAGE)-$(VERSION)
5052
TARBALL_NAME := $(PACKAGE)-$(VERSION).tar.gz
5153
UPSTREAM := /p/vdt/public/html/upstream
5254
UPSTREAM_DIR := $(UPSTREAM)/$(PACKAGE)/$(VERSION)
53-
INSTALL_PYTHON_DIR := $(shell python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()')
55+
INSTALL_PYTHON_DIR := $(shell $(PYTHON) -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')
5456

5557

5658
# ------------------------------------------------------------------------------

osg-test-log-viewer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22
"""View the output from osg-test in a structured way"""
33
from __future__ import print_function
44

rpm/osg-test.spec

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,33 @@ installation.
2020
%package log-viewer
2121
Summary: Views the output of %{name}
2222
Group: Applications/Grid
23+
%if 0%{?rhel} >= 8 || 0%{?fedora} >= 31
24+
Requires: python3-tkinter
25+
Requires: python3-six
26+
%else
2327
Requires: tkinter
2428
Requires: python-six
29+
%endif
2530

2631
%description log-viewer
2732
A GUI for viewing the output of %{name} in a structured manner.
2833

34+
%if 0%{?rhel} >= 8
35+
%define __python /usr/libexec/platform-python
36+
%else
37+
%if 0%{?fedora} >= 31
38+
%define __python /usr/bin/python3
39+
%else
40+
%define __python /usr/bin/python2
41+
%endif
42+
%endif
43+
2944
%prep
3045
%setup -q
3146

3247
%install
33-
make install DESTDIR=$RPM_BUILD_ROOT
48+
find . -type f -exec sed -ri '1s,^#!/usr/bin/env python,#!%{__python},' '{}' +
49+
make install DESTDIR=$RPM_BUILD_ROOT PYTHON=%{__python}
3450
%if 0%{?fedora} < 25 && 0%{?rhel} < 8
3551
rm -rf $RPM_BUILD_ROOT%{python_sitelib}/osgtest/vendor
3652
%endif

0 commit comments

Comments
 (0)