comparison setup.py @ 8728:f3fab7b124f2

imports: try to use global imports unless it is a layering violation To minimize the impact, do imports that violate the layering at runtime instead of at import time.
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 01 Nov 2020 06:29:32 +0100
parents c6964daffe57
children 385d1b31f386
comparison
equal deleted inserted replaced
8727:c98c7d4c9ec3 8728:f3fab7b124f2
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*- 2 # -*- coding: utf-8 -*-
3 import os 3 import os
4 import platform 4 import platform
5 import re
5 import sys 6 import sys
6 7
7 import setuptools 8 import setuptools
8 # monkey patch setuptools to use distutils owner/group functionality 9 # monkey patch setuptools to use distutils owner/group functionality
9 from setuptools.command import sdist 10 from setuptools.command import sdist
15 16
16 here = os.path.abspath(os.path.dirname(__file__)) 17 here = os.path.abspath(os.path.dirname(__file__))
17 18
18 19
19 def _get_meta_var(name, data, callback_handler=None): 20 def _get_meta_var(name, data, callback_handler=None):
20 import re
21 matches = re.compile(r'(?:%s)\s*=\s*(.*)' % name).search(data) 21 matches = re.compile(r'(?:%s)\s*=\s*(.*)' % name).search(data)
22 if matches: 22 if matches:
23 s = eval(matches.groups()[0]) 23 s = eval(matches.groups()[0])
24 if callable(callback_handler): 24 if callable(callback_handler):
25 return callback_handler(s) 25 return callback_handler(s)