diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2020-03-25 13:29:50 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-03-25 13:48:20 -0400 |
commit | a3620a45b3df9be32316bd8807ca5a83c1380c9a (patch) | |
tree | e4d67217f4e89281f1b678237a122669607534d4 /setuptools/tests | |
parent | e5a8bfedcba9e4971b0d11adc0e37f69b8e69a92 (diff) | |
download | external_python_setuptools-a3620a45b3df9be32316bd8807ca5a83c1380c9a.tar.gz external_python_setuptools-a3620a45b3df9be32316bd8807ca5a83c1380c9a.tar.bz2 external_python_setuptools-a3620a45b3df9be32316bd8807ca5a83c1380c9a.zip |
Add test asserting that an executable script retains its executable bit. Ref #2041.
Diffstat (limited to 'setuptools/tests')
-rw-r--r-- | setuptools/tests/test_build_py.py | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/setuptools/tests/test_build_py.py b/setuptools/tests/test_build_py.py index 92b455dd..4cb11c1d 100644 --- a/setuptools/tests/test_build_py.py +++ b/setuptools/tests/test_build_py.py @@ -26,9 +26,10 @@ def test_directories_in_package_data_glob(tmpdir_cwd): def test_read_only(tmpdir_cwd): """ - Ensure mode is not preserved in copy for package modules - and package data, as that causes problems - with deleting read-only files on Windows. + Ensure read-only flag is not preserved in copy + for package modules and package data, as that + causes problems with deleting read-only files on + Windows. #1451 """ @@ -47,3 +48,29 @@ def test_read_only(tmpdir_cwd): dist.parse_command_line() dist.run_commands() shutil.rmtree('build') + + +def test_executable_data(tmpdir_cwd): + """ + Ensure executable bit is preserved in copy for + package data, as users rely on it for scripts. + + #2041 + """ + dist = Distribution(dict( + script_name='setup.py', + script_args=['build_py'], + packages=['pkg'], + package_data={'pkg': ['run-me']}, + name='pkg', + )) + os.makedirs('pkg') + open('pkg/__init__.py', 'w').close() + open('pkg/run-me', 'w').close() + os.chmod('pkg/run-me', 0o700) + + dist.parse_command_line() + dist.run_commands() + + assert os.stat('build/lib/pkg/run-me').st_mode & stat.S_IEXEC, \ + "Script is not executable" |