Bug 2196

Summary: Add %_pythonlibdir macro
Product: Sisyphus Reporter: Mikhail Zabaluev <mhz>
Component: rpm-build-pythonAssignee: Andrey Orlov <cray>
Status: CLOSED DUPLICATE QA Contact: qa-sisyphus
Severity: enhancement    
Priority: P5 CC: cray, darktemplar, george, imz, ldv
Version: unstable   
Hardware: all   
OS: Linux   

Description Mikhail Zabaluev 2003-02-09 13:12:17 MSK
The definition would be
%_pythonlibdir %(%__python -c \&quot;from distutils import sysconfig; print sysconfig.get_python_lib()\&quot;)

While we are at it, change %__python_version to
%__python_version %(%__python -c \&quot;import sys; print sys.version.split(\' \')[0]\&quot;)
Don\'t let anyone know that you are more skilled in shell than in Python ;)
---

---

Comment 1 Dmitry V. Levin 2003-02-10 09:17:57 MSK
1. Your version  of %__python_version differs from current one:
$ rpm --eval %__python_version
2.2
$ python -c \&quot;import sys; print sys.version.split(\' \')[0]\&quot;
2.2.2
I won\'t change behaviour.

2. Who needs this new macro?
Comment 2 Dmitry V. Levin 2003-02-10 09:17:57 MSK
1. Your version  of %__python_version differs from current one:
$ rpm --eval %__python_version
2.2
$ python -c \&quot;import sys; print sys.version.split(\' \')[0]\&quot;
2.2.2
I won\'t change behaviour.

2. Who needs this new macro?
Comment 3 Mikhail Zabaluev 2003-02-11 02:34:56 MSK
Agreed, although it would be better to print out the trimmed value
using only Python, e.g.
%(python -c \&quot;import sys, re; print re.match(\'[0-9]+\\.[0-9]+\', sys.version.split(\' \')[0]).group(0)\&quot; 2&gt;/dev/null)
Comment 4 Mikhail Zabaluev 2003-02-11 02:34:56 MSK
Agreed, although it would be better to print out the trimmed value
using only Python, e.g.
%(python -c \&quot;import sys, re; print re.match(\'[0-9]+\\.[0-9]+\', sys.version.split(\' \')[0]).group(0)\&quot; 2&gt;/dev/null)
Comment 5 Mikhail Zabaluev 2003-02-13 02:58:37 MSK
The %_pythonlibdir macro is useful for Python modules installed with help of distutils (e.g. pretty much every Python module today). Instead of using
inflexible globs like %_libdir/python*/site-packages/, the exact path
could be determined programmatically.
Comment 6 Mikhail Zabaluev 2003-02-13 02:58:37 MSK
The %_pythonlibdir macro is useful for Python modules installed with help of distutils (e.g. pretty much every Python module today). Instead of using
inflexible globs like %_libdir/python*/site-packages/, the exact path
could be determined programmatically.
Comment 7 Dmitry V. Levin 2004-05-17 19:05:21 MSD
Andrey?
Comment 8 Andrey Orlov 2004-05-18 00:59:21 MSD
Извините за русский, но с моим локализованным английским ваша продвинутая версия 
понимается с трудом, тем не менее: 
 
1. Обратите внимание на то, как %__python_version считается сейчас 
 
__python_version   %(%__python -c 'import sys; print "%u.%u" % sys.version_info[0:2]' 
2>/dev/null || echo unknown) 
 
. Это лучше и шелловских скриптов и каких-то регекспов на питоне.  
 
2. Чгря слабо понимаю как стыкуется чисто python'вский distutils с rpm-овскими 
макросами, в любом случае, все модули, использованные во время эксперимента на 
дедали ставились с помощью distutils  и отсутствие такой переменной никому 
не мешало. Подробнее см. python-module-SAMPLE.spec. 
 
3. Если человеку удобен такой макрос - то почему бы не создать, может пригодится 
если ставить __БЕЗ__ distutils, что иногда приходится делать. 
 
 
Comment 9 Dmitry V. Levin 2004-06-26 15:38:20 MSD
Немного бюрократии.
Comment 10 Andrey Orlov 2004-06-26 16:27:08 MSD
(In reply to comment #9) 
> Немного бюрократии. 
 
Я не против бюрократии, только я не понял, чего предполагается сделать? 
 
Comment 11 Andrey Orlov 2004-09-11 20:27:06 MSD

*** This bug has been marked as a duplicate of 4815 ***