python制作rpm包,pip依赖也打包进rpm中
spec
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# 定义部署路径 %define PythonDir /usr/local/python39-zeus # 不生成debug包 %define debug_package %{nil} # 指定python解释器,默认为系统的/usr/bin/python %global __python /usr/bin/python3 # 删除brp 编译、strip等,不删除,编译后的python 部分库的so 不正确 %global __os_install_post %{nil} # 关闭brp 编译错误终止 %global _python_bytecompile_errors_terminate_build 0 Name: python39-zeus Version: 3.9.13 Release: 1 Summary: python39 by Zeus License: Apache License v2.0 Vendor: Qihoo/devse Group: Applications/System URL: http://devse.cn/ Source0: Python-3.9.13.tgz Source1: 01_lcm.txt Source2: 02_ares.txt Source3: 03_asset.txt Source4: 04_django.txt Source5: 05_fin.txt Source6: pip3 BuildRoot: %{_tmppath}/%{name}-%{rel_ver}-%{release}-root BuildRequires: autoconf BuildRequires: bzip2-devel BuildRequires: gcc-c++ BuildRequires: libffi-devel BuildRequires: libtirpc-devel BuildRequires: ncurses-devel BuildRequires: /bin/mysql_config BuildRequires: pkgconfig BuildRequires: readline-devel BuildRequires: sqlite-devel BuildRequires: gdb BuildRequires: tar BuildRequires: tcl-devel BuildRequires: tix-devel BuildRequires: tk-devel BuildRequires: xz-devel BuildRequires: zlib-devel BuildRequires: openssl Requires: openssl #Requires: /bin/mysql_config Requires: zlib-devel Requires: bzip2-devel Requires: libcurl Requires: libyaml Requires: libffi-devel Requires: libtirpc-devel Requires: ncurses-devel Requires: sqlite-devel AutoReqProv: no Obsoletes: %{name} < %{version}-%{release} #Conflicts: %{name} %description python39 %prep %setup -q -n Python-3.9.13 %build autoconf autoheader %configure ./configure --prefix=%{PythonDir} --with-openssl=/usr/local/qh-openssl --enable-shared make %{?_smp_mflags} OPTIMIZE="%{optflags}" %install make DESTDIR=%{buildroot} INSTALL="install -p" install # 将依赖包在安装阶段,打到rpm中 %{PythonDir}/bin/python3 -m pip install -r %{SOURCE1} --root %{buildroot} --progress-bar off --no-warn-script-location %{PythonDir}/bin/python3 -m pip install -r %{SOURCE2} --root %{buildroot} --progress-bar off --no-warn-script-location %{PythonDir}/bin/python3 -m pip install -r %{SOURCE3} --root %{buildroot} --progress-bar off --no-warn-script-location %{PythonDir}/bin/python3 -m pip install -r %{SOURCE4} --root %{buildroot} --progress-bar off --no-warn-script-location %{PythonDir}/bin/python3 -m pip install -r %{SOURCE5} --root %{buildroot} --progress-bar off --no-warn-script-location %{buildroot}%{PythonDir}/bin/python3 -m ensurepip install -p -m 755 %{SOURCE6} %{buildroot}%{PythonDir}/bin/pip3 install -p -m 755 %{SOURCE6} %{buildroot}%{PythonDir}/bin/pip3.9 %post %postun # 0 uninstall, 1 install, 2 update %clean rm -rf %{buildroot} %files %dir %defattr(-,root,root,-) %{PythonDir} %changelog |