Skip to content

Commit a3edb9a

Browse files
authored
Merge pull request #268 from fstagni/removePy2_neww
Remove py2 (trial 2)
2 parents 7d1766b + 36d6359 commit a3edb9a

File tree

11 files changed

+308
-317
lines changed

11 files changed

+308
-317
lines changed

.github/workflows/basic.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
python:
27-
- 2.7.18
2827
- 3.6.15
2928
- 3.9.17
3029

@@ -55,7 +54,6 @@ jobs:
5554
fail-fast: false
5655
matrix:
5756
python:
58-
- 2.7.18
5957
- 3.6.15
6058
- 3.9.17
6159

@@ -82,7 +80,6 @@ jobs:
8280
fail-fast: false
8381
matrix:
8482
python:
85-
- 2.7.18
8683
- 3.6.15
8784
- 3.9.17
8885

.pylintrc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,3 @@ dummy-variables=_
1818
disable=
1919
invalid-name,
2020
line-too-long, # would be nice to remove this one
21-
consider-using-f-string, # python2/3 support
22-
unspecified-encoding, # python2/3 support
23-
super-with-arguments, # python2/3 support
24-
redefined-builtin, # python2/3 support

Pilot/__init__.py

Whitespace-only changes.

Pilot/dirac-pilot.py

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,19 @@
1919
But, as said, all the actions are actually configurable.
2020
"""
2121

22-
from __future__ import absolute_import, division, print_function
23-
2422
import os
2523
import sys
2624
import time
25+
from io import StringIO
2726

28-
############################
29-
# python 2 -> 3 "hacks"
30-
31-
try:
32-
from cStringIO import StringIO
33-
except ImportError:
34-
from io import StringIO
27+
from pilotTools import (
28+
Logger,
29+
PilotParams,
30+
RemoteLogger,
31+
getCommand,
32+
pythonPathCheck,
33+
)
3534

36-
try:
37-
from Pilot.pilotTools import (
38-
Logger,
39-
PilotParams,
40-
RemoteLogger,
41-
getCommand,
42-
pythonPathCheck,
43-
)
44-
except ImportError:
45-
from pilotTools import (
46-
Logger,
47-
PilotParams,
48-
RemoteLogger,
49-
getCommand,
50-
pythonPathCheck,
51-
)
5235
############################
5336

5437
if __name__ == "__main__":

Pilot/pilotCommands.py

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ def __init__(self, pilotParams):
1717
execution.
1818
"""
1919

20-
from __future__ import absolute_import, division, print_function
21-
2220
import filecmp
2321
import os
2422
import platform
@@ -28,39 +26,18 @@ def __init__(self, pilotParams):
2826
import sys
2927
import time
3028
import traceback
31-
import subprocess
3229
from collections import Counter
30+
from http.client import HTTPSConnection
31+
from shlex import quote
32+
33+
from pilotTools import (
34+
CommandBase,
35+
getSubmitterInfo,
36+
retrieveUrlTimeout,
37+
safe_listdir,
38+
sendMessage,
39+
)
3340

34-
############################
35-
# python 2 -> 3 "hacks"
36-
try:
37-
# For Python 3.0 and later
38-
from http.client import HTTPSConnection
39-
except ImportError:
40-
# Fall back to Python 2
41-
from httplib import HTTPSConnection
42-
43-
try:
44-
from shlex import quote
45-
except ImportError:
46-
from pipes import quote
47-
48-
try:
49-
from Pilot.pilotTools import (
50-
CommandBase,
51-
getSubmitterInfo,
52-
retrieveUrlTimeout,
53-
safe_listdir,
54-
sendMessage,
55-
)
56-
except ImportError:
57-
from pilotTools import (
58-
CommandBase,
59-
getSubmitterInfo,
60-
retrieveUrlTimeout,
61-
safe_listdir,
62-
sendMessage,
63-
)
6441
############################
6542

6643

@@ -283,7 +260,7 @@ def _getPreinstalledEnvScript(self):
283260
self.pp.installEnv["DIRAC_RC_PATH"] = preinstalledEnvScript
284261

285262
def _localInstallDIRAC(self):
286-
"""Install python3 version of DIRAC client"""
263+
"""Install DIRAC client"""
287264

288265
self.log.info("Installing DIRAC locally")
289266

@@ -296,10 +273,7 @@ def _localInstallDIRAC(self):
296273

297274
# 1. Get the DIRACOS installer name
298275
# curl -O -L https://github.com/DIRACGrid/DIRACOS2/releases/latest/download/DIRACOS-Linux-$(uname -m).sh
299-
try:
300-
machine = os.uname().machine # py3
301-
except AttributeError:
302-
machine = os.uname()[4] # py2
276+
machine = os.uname().machine
303277

304278
installerName = "DIRACOS-Linux-%s.sh" % machine
305279

0 commit comments

Comments
 (0)