[PATCH] D68779: [LNT][NFC] Fix global import in function
Thomas Preud'homme via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 5 07:21:08 PST 2019
thopre updated this revision to Diff 232342.
thopre marked an inline comment as done.
thopre added a comment.
Use importlib.import_module instead of __import__, bumping Python 3.x requirements
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68779/new/
https://reviews.llvm.org/D68779
Files:
lnt/lnttool/admin.py
setup.py
Index: setup.py
===================================================================
--- setup.py
+++ setup.py
@@ -9,8 +9,8 @@
import sys
from setuptools import setup, find_packages, Extension
-if sys.version_info < (2, 7):
- raise RuntimeError("Python 2.7 or higher required.")
+if sys.version_info < (2, 7) or sys.version_info == (3, 0):
+ raise RuntimeError("Python 2.7 or Python 3.1 or higher required.")
cflags = []
Index: lnt/lnttool/admin.py
===================================================================
--- lnt/lnttool/admin.py
+++ lnt/lnttool/admin.py
@@ -1,16 +1,17 @@
#!/usr/bin/env python
import click
+from importlib import import_module
from .common import submit_options
def _load_dependencies():
global yaml, sys, requests, json, os, httplib
- import yaml
- import sys
- import requests
- import json
- import os
- import httplib
+ yaml = import_module('yaml')
+ sys = import_module('sys')
+ requests = import_module('requests')
+ json = import_module('json')
+ os = import_module('os')
+ httplib = import_module('httplib')
def _error(msg):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68779.232342.patch
Type: text/x-patch
Size: 1131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191205/773f8410/attachment.bin>
More information about the llvm-commits
mailing list