\!/ KyuuKazami \!/

Path : /etc/rpm/
Upload :
Current File : //etc/rpm/macros.python26

%_python26_major 2
%_python26_minor 6
%_python26_version %{_python26_major}.%{_python26_minor}
%_python26 python%{_python26_version}

%__python26 %{_bindir}/%{_python26}
%_python26_sitelib %(%{__python26} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%python26_sitelib %{_python26_sitelib}
%_python26_sitearch %(%{__python26} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True))")
%python26_sitearch %{_python26_sitearch}

%python26_version  %{_python26_version}
%_python26_abi     %{_python26_version}
%_python26_basever %{_python26_major}%{_python26_minor}

%__python26_shebang sed -i -r -e '1s,^#![[:space:]]*/(usr/)?(local/)?bin/(env )?python($|[[:space:]]),#!'%{__python26}'\\4,'

%__python26_shebang_path()\
%{?!1:echo "No path provided for %%__python26_shebang_path.";exit 1}\
shebang_path="%1"\
find $shebang_path -type f -print -exec %{__python26_shebang} "{}" \\+ || :\
%{nil}

%_python26_bytecompile_script 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("$RPM_BUILD_ROOT")[2]) for f in sys.argv[1:]]'
%__python26_bytecompile_pyc %{__python26} -c %{_python26_bytecompile_script}
%__python26_bytecompile_pyo %{__python26} -O -c %{_python26_bytecompile_script}

%__python26_bytecompile_path()\
%{?!1:echo "No path provided for %%__python26_byte_compile_path.";exit 1}\
bytecode_compilation_path="%1"\
find $bytecode_compilation_path -type f -name "*.py" -print -exec %{__python26_bytecompile_pyc} "{}" \\+ || :\
\
find $bytecode_compilation_path -type f -name "*.py" -print -exec %{__python26_bytecompile_pyo} "{}" \\+ || :\
%{nil}

@KyuuKazami