Skip to content

Commit ebed06d

Browse files
authored
BIGTOP-4063: Adapt bigtop-select to Python 3 (#1236)
* BIGTOP-4063: Adapt bigtop-select to Python 3
1 parent 798c33c commit ebed06d

File tree

4 files changed

+10
-241
lines changed

4 files changed

+10
-241
lines changed

bigtop-packages/src/common/bigtop-select/conf-select

Lines changed: 0 additions & 224 deletions
This file was deleted.

bigtop-packages/src/common/bigtop-select/distro-select

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python2
1+
#!/usr/bin/env python3
22
#
33
# Licensed to the Apache Software Foundation (ASF) under one
44
# or more contributor license agreements. See the NOTICE file
@@ -71,7 +71,7 @@ leaves = {
7171
"ranger-usersync" : "ranger-usersync",
7272
"ranger-tagsync" : "ranger-tagsync",
7373
"livy-server" : "livy",
74-
"livy-client" : "livy"
74+
"livy-client" : "livy",
7575
"alluxio": "alluxio",
7676
"alluxio-master": "alluxio",
7777
"alluxio-worker": "alluxio"
@@ -161,7 +161,7 @@ def listPackages( packages ):
161161
if packages == None:
162162
packages = leaves
163163

164-
packages.sort()
164+
packages = sorted(packages)
165165
for pkg in packages:
166166
linkname = current + "/" + pkg
167167
if os.path.isdir(linkname):
@@ -172,13 +172,11 @@ def listPackages( packages ):
172172

173173
# Print the avaialable package names
174174
def printPackages():
175-
packages = leaves.keys()
176-
packages.sort()
175+
packages = sorted(leaves.keys())
177176
print("Packages:")
178177
for pkg in packages:
179178
print(" " + pkg)
180-
groups = aliases.keys()
181-
groups.sort()
179+
groups = sorted(aliases.keys())
182180
print("Aliases:")
183181
for pkg in groups:
184182
print(" " + pkg)
@@ -203,8 +201,7 @@ def printVersions():
203201
print("ERROR: Unexpected file/directory found in %s: %s" % (root, f))
204202
sys.exit(1)
205203

206-
keys = result.keys()
207-
keys.sort()
204+
keys = sorted(result.keys())
208205
for k in keys:
209206
print(result[k])
210207

@@ -225,9 +222,9 @@ def setPackages(packages, version, rpm_mode):
225222
sys.exit(1)
226223

227224
if not os.path.isdir(current):
228-
os.mkdir(current, 0755)
225+
os.mkdir(current, 0o755)
229226

230-
packages.sort()
227+
packages = sorted(packages)
231228
for pkg in packages:
232229
linkname = current + "/" + pkg
233230
if os.path.islink(linkname) and rpm_mode:

bigtop-packages/src/common/bigtop-select/install_select.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,13 @@ CONF_DIR=${CONF_DIR:-/etc/bigtop-select/conf.dist}
7979

8080
STACK_ROOT_DIR=$(echo ${PARENT_DIR} | sed -e "s/\/${BIGTOP_BASE_VERSION}$//")
8181
STACK_SELECTOR=distro-select
82-
CONF_SELECTOR=conf-select
8382

8483
# Install packages
8584
install -d -p -m 755 $PREFIX${LIB_DIR}/
8685
install -d -p -m 755 $PREFIX${PARENT_DIR}/
8786
install -p -m 755 ${DISTRO_DIR}/${STACK_SELECTOR} $PREFIX${LIB_DIR}/
88-
install -p -m 755 ${DISTRO_DIR}/${CONF_SELECTOR} $PREFIX${LIB_DIR}/
8987
cat > $PREFIX${LIB_DIR}/params.py <<EOF
90-
#!/usr/bin/env python2
88+
#!/usr/bin/env python3
9189
#
9290
# Licensed to the Apache Software Foundation (ASF) under one
9391
# or more contributor license agreements. See the NOTICE file

bigtop-packages/src/rpm/bigtop-select/SPECS/bigtop-select.spec

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
3232
BuildArch: noarch
3333
Source0: install_select.sh
3434
Source1: LICENSE
35-
Source2: conf-select
36-
Source3: distro-select
35+
Source2: distro-select
3736
Requires: bash
3837

3938
# "which" command is needed for a lot of projects.
@@ -53,7 +52,6 @@ This includes a collection of useful tools and files for Bigtop and Ambari
5352
install -p -m 755 %{SOURCE0} .
5453
install -p -m 755 %{SOURCE1} .
5554
install -p -m 755 %{SOURCE2} .
56-
install -p -m 755 %{SOURCE3} .
5755

5856

5957
%build

0 commit comments

Comments
 (0)