Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c8b8cbf

Browse files
committed
Fix for py26
1 parent 8621957 commit c8b8cbf

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

setup.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
from setuptools.command.sdist import sdist as _sdist
88

99

10+
def check_output(*args, **kwargs):
11+
from subprocess import Popen
12+
proc = Popen(*args, **kwargs)
13+
output, _ = proc.communicate()
14+
rv = proc.poll()
15+
assert rv == 0, output
16+
17+
1018
class build_regexes(Command):
1119
description = 'build supporting regular expressions from uap-core'
1220
user_options = [
@@ -24,8 +32,7 @@ def finalize_options(self):
2432
def run(self):
2533
work_path = self.work_path
2634
if os.path.exists(os.path.join(work_path, '.git')):
27-
from subprocess import check_output
28-
log.info("initializing git submodules")
35+
log.info('initializing git submodules')
2936
check_output(['git', 'submodule', 'init'], cwd=work_path)
3037
check_output(['git', 'submodule', 'update'], cwd=work_path)
3138

@@ -39,9 +46,10 @@ def force_bytes(text):
3946
return text
4047
return text.encode('utf8')
4148

42-
log.info('Converting regexes.yaml to _regexes.py...')
4349
import yaml
4450
py_dest = os.path.join(work_path, 'ua_parser', '_regexes.py')
51+
52+
log.info('Compiling regexes.yaml -> _regexes.py')
4553
with open(yaml_src, 'rb') as fp:
4654
regexes = yaml.safe_load(fp)
4755
with open(py_dest, 'wb') as fp:

0 commit comments

Comments
 (0)