Skip to content

Commit c225bf2

Browse files
committed
Blacklist files depending on python version
Because the compilation to .pyo extension only exists for python2. Since python >= 3.5 the extension for the compiled files is .pyc.
1 parent c5d3c8b commit c225bf2

File tree

1 file changed

+10
-4
lines changed
  • pythonforandroid/bootstraps/common/build

1 file changed

+10
-4
lines changed

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ def get_hostpython():
3838
return get_dist_info_for('hostpython')
3939

4040

41+
def get_python_version():
42+
return get_dist_info_for('python_version')
43+
44+
4145
def get_bootstrap_name():
4246
return get_dist_info_for('bootstrap')
4347

@@ -52,6 +56,7 @@ def get_bootstrap_name():
5256
curdir = dirname(__file__)
5357

5458
PYTHON = get_hostpython()
59+
PYTHON_VERSION = get_python_version()
5560
if PYTHON is not None and not exists(PYTHON):
5661
PYTHON = None
5762

@@ -62,17 +67,18 @@ def get_bootstrap_name():
6267
'^*.bzr/*',
6368
'^*.svn/*',
6469

65-
# pyc/py
66-
'*.pyc',
67-
# '*.py',
68-
6970
# temp files
7071
'~',
7172
'*.bak',
7273
'*.swp',
7374
]
75+
# pyc/py
7476
if PYTHON is not None:
7577
BLACKLIST_PATTERNS.append('*.py')
78+
if PYTHON_VERSION and int(PYTHON_VERSION[0]) == 2:
79+
# we only blacklist `.pyc` for python2 because in python3 the compiled
80+
# extension is `.pyc` (.pyo files not exists for python >= 3.6)
81+
BLACKLIST_PATTERNS.append('*.pyc')
7682

7783
WHITELIST_PATTERNS = []
7884
if get_bootstrap_name() in ('sdl2', 'webview', 'service_only'):

0 commit comments

Comments
 (0)