From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 21 Mar 2007 12:29:07 +0300 From: "Alexey M. Tourbin" To: devel@lists.altlinux.org Message-ID: <20070321092906.GQ1613@solemn.turbinal> Mail-Followup-To: devel@lists.altlinux.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mpb+VUhBqKoEsre9" Content-Disposition: inline Subject: [devel] rpm-build-python 0.30-alt1 X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.9rc1 Precedence: list Reply-To: ALT Devel discussion list List-Id: ALT Devel discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2007 09:30:13 -0000 Archived-At: List-Archive: List-Post: --mpb+VUhBqKoEsre9 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable =F1 =D0=CF=C4=C7=CF=D4=CF=D7=C9=CC =CE=CF=D7=D5=C0 =D3=C2=CF=D2=CB=D5 rpm-b= uild-python. 0.30-alt1 =20 - python.req.py: + fixed a bug in "import" clause analysis, due to which only the first dependency of multiple arguments was produced; i.e. Old result: 'import os, re' -> Requires: python2.4(os) New result: 'import os, re' -> Requires: python2.4(os), python2.4(r= e) + made it fail on import errors (also python.prov.py) + made it print stderr diagnostics when the dependency is being ignor= ed + disabled .py suffix check, for the sake of plain python scripts - added dependency on python-base, so that python.req.py and python.pro= v.py always work (also explained this change in policy/5-Python_FAQ.txt) - added buildreq skiplist and placed LC_ALL=3DC as needed in order to a= void dumb dependency on encoding modules when e.g. evaluating %%__python_v= ersion - added new files, for possible use with future rpm-build releases: + python.req (python.prov) - wrapper for python.req.py (resp. python.= prov.py) + python.req.files (.prov.files) - will select python files for req/p= rov + /etc/rpm/macros.d/python.env - piece of rpm-build scriplets' preamb= le + also placed rpm-build python macros to /etc/rpm/macros.d/python $ git-diff origin.. |iconv -f utf8 diff --git a/.exrc b/.exrc new file mode 100644 index 0000000..1cf99a9 --- /dev/null +++ b/.exrc @@ -0,0 +1 @@ +set ts=3D8 sts=3D4 sw=3D4 et diff --git a/rpm-build-python.spec b/rpm-build-python.spec index ee5c39d..4c746d9 100644 --- a/rpm-build-python.spec +++ b/rpm-build-python.spec @@ -1,6 +1,6 @@ Name: rpm-build-python -Version: 0.29 -Release: alt5 +Version: 0.30 +Release: alt1 =20 # redefine python_libdir for 0.29.alt2 is buggy=20 %define python_libdir %_target_libdir/python%__python_version @@ -14,6 +14,7 @@ BuildArch: noarch Packager: Python Development Team =20 Requires: rpm-build >=3D 0:4.0.4-alt39 +Requires: python-base >=3D 2.4.4-alt8 BuildRequires: python, rpm-build >=3D 0:4.0.4-alt39 AutoReqProv: yes, nopython =20 @@ -37,9 +38,15 @@ subst 's/@PYTHON_VERSION@/%__python_version/g' python =20 %install install -pD -m644 python %buildroot%_sysconfdir/rpm/macros.d/python -install -pD -m755 python.prov.py %buildroot%_target_libdir/rpm/python.prov= .py -install -pD -m755 python.req.py %buildroot%_target_libdir/rpm/python.req.py -install -pD -m755 python.compileall.py %buildroot%_target_libdir/rpm/pytho= n.compileall.py +install -pD -m644 python.env %buildroot%_sysconfdir/rpm/macros.d/python.env +install -pD -m644 python.buildreq %buildroot%_sysconfdir/buildreqs/files/i= gnore.d/%name +install -pD -m755 python.prov %buildroot%_rpmlibdir/python.prov +install -pD -m755 python.prov.py %buildroot%_rpmlibdir/python.prov.py +install -pD -m755 python.prov.files %buildroot%_rpmlibdir/python.prov.files +install -pD -m755 python.req %buildroot%_rpmlibdir/python.req +install -pD -m755 python.req.py %buildroot%_rpmlibdir/python.req.py +install -pD -m755 python.req.files %buildroot%_rpmlibdir/python.req.files +install -pD -m755 python.compileall.py %buildroot%_rpmlibdir/python.compil= eall.py install -pd -m755 %buildroot%python_tooldir/rpm-build install -pD -m644 bdist_altrpm.py %buildroot%_libdir/python%__python_versi= on/distutils/command/bdist_altrpm.py install -pD -m755 tools/*py %buildroot%python_tooldir/rpm-build @@ -55,9 +62,15 @@ unset RPM_PYTHON =20 %files %_sysconfdir/rpm/macros.d/python -%_target_libdir/rpm/python.compileall.py -%_target_libdir/rpm/python.req.py -%_target_libdir/rpm/python.prov.py +%_sysconfdir/rpm/macros.d/python.env +%_sysconfdir/buildreqs/files/ignore.d/%name +%_rpmlibdir/python.compileall.py +%_rpmlibdir/python.req +%_rpmlibdir/python.req.py +%_rpmlibdir/python.req.files +%_rpmlibdir/python.prov +%_rpmlibdir/python.prov.py +%_rpmlibdir/python.prov.files %_libdir/python%__python_version/distutils/command/bdist_altrpm.py %doc python-module-SAMPLE.spec policy notes doc =20 @@ -66,6 +79,25 @@ unset RPM_PYTHON %python_tooldir/rpm-build =20 %changelog +* Wed Mar 21 2007 Alexey Tourbin 0.30-alt1 +- python.req.py: + + fixed a bug in "import" clause analysis, due to which only + the first dependency of multiple arguments was produced; i.e. + Old result: 'import os, re' -> Requires: python2.4(os) + New result: 'import os, re' -> Requires: python2.4(os), python2.4(re) + + made it fail on import errors (also python.prov.py) + + made it print stderr diagnostics when the dependency is being ignored + + disabled .py suffix check, for the sake of plain python scripts +- added dependency on python-base, so that python.req.py and python.prov.py + always work (also explained this change in policy/5-Python_FAQ.txt) +- added buildreq skiplist and placed LC_ALL=3DC as needed in order to avoid + dumb dependency on encoding modules when e.g. evaluating %%__python_vers= ion +- added new files, for possible use with future rpm-build releases: + + python.req (python.prov) - wrapper for python.req.py (resp. python.pro= v.py) + + python.req.files (.prov.files) - will select python files for req/prov + + /etc/rpm/macros.d/python.env - piece of rpm-build scriplets' preamble + + also placed rpm-build python macros to /etc/rpm/macros.d/python + * Sat Jan 13 2007 Fr. Br. George 0.29-alt5 - (avm@) Search for .pth files in lib64, too - Minor policy fix diff --git a/rpm-build-python/policy/5-Python_FAQ.txt b/rpm-build-python/po= licy/5-Python_FAQ.txt index 27afd3d..591b4f5 100644 --- a/rpm-build-python/policy/5-Python_FAQ.txt +++ b/rpm-build-python/policy/5-Python_FAQ.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=D7=C1=D4=C1=C5=D4 =D7=D3=C5=C7=CF =D4=D2=C5=C8 + =C6=C1=CA=CC=CF=D7 - parser.so, token.py =C9 symbol.py); =C9 = =C4=CF=C2=C1=D7=C9=D4=D8 =DA=C1=D7=C9=D3=C9=CD=CF=D3=D4=D8 + =CE=C1 =D4=C1=CB=CF=CA python-base =D7 rpm-build-python. =EE= =C1=CC=C9=DE=C9=C5 python-base + =D7 =C2=C1=DA=CF=D7=CF=CA =D3=C2=CF=D2=CF=DE=CE=CF=CA =D3=D2= =C5=C4=C5 =CE=C5 =C4=CF=CC=D6=CE=CF =CE=C9=CB=CF=C7=CF =D3=C9=CC=D8=CE=CF = =D2=C1=D3=D3=D4=D2=CF=C9=D4=D8, + =D0=CF=D3=CB=CF=CC=D8=CB=D5 python-base =D7 =D2=C1=DA=D7=C5=D2= =CE=D5=D4=CF=CD =D7=C9=C4=C5 =DA=C1=CE=C9=CD=C1=C5=D4 =DE=D5=D4=D8 =C2=CF= =CC=D8=DB=C5 2M. + =FA=C1=D4=CF rpm-build-python =C2=D5=C4=C5=D4 =D2=C1=C2=CF=D4= =C1=D4=D8 =CE=C1=C4=C5=D6=CE=CF. + =F3=CF=C2=D3=D4=D7=C5=CE=CE=CF =C9=D3=D0=D2=C1=D7=CC=C5=CE=C9=C5 = =CF=DB=C9=C2=CB=C9 =D3=D7=C5=CC=CF=D3=D8 =CB =CF=C2=C5=D3=D0=C5=DE=C5=CE=C9= =C0 =D7=D9=D0=CF=CC=CE=C5=CE=C9=D1 =D5=D3=CC=CF=D7=C9=D1-2. =F1 =DC=D4=CF =D0=D2=CF=D7=C5=D2=C9=CC, = =CE=C1 =D0=C1=D2=C5 =D0=C1=CB=C5=D4=CF=D7 - =CF=CE=C9 =C4=C5=CA=D3=D4=D7=C9= =D4=C5=CC=D8=CE=CF =D2=C1=CE=D8=DB=C5 =D0=C1=C4=C1=CC=C9 =D0=D2=C9 =D3=C2=CF=D2=CB=C5= , =D4=CF=C7=C4=C1 =CB=C1=CB =D4=C5=D0=C5=D2=D8 =CE=C5 =D0=C1=C4=C1=C0=D4. diff --git a/rpm-build-python/python b/rpm-build-python/python index 81db52c..af9a622 100644 --- a/rpm-build-python/python +++ b/rpm-build-python/python @@ -2,8 +2,25 @@ # -*- coding: utf-8 -*- =20 # Override __python_version macro provided by rpm-build=20 -%__python_version %(%__python -c 'import sys; print "%%u.%%u" %% sys.versi= on_info[0:2]' 2>/dev/null || echo @PYTHON_VERSION@) - +%__python_version %(LC_ALL=3DC %__python -c 'import sys; print "%%u.%%u" %= % sys.version_info[0:2]' 2>/dev/null || echo @PYTHON_VERSION@) + +%_python_lib_path "" +%_python_req_method slight +%_python_req_skip "" +%_python_compile_method ALL +%_python_compile_exclude /usr/share/doc +%_python_compile_include /usr/%_lib +%_python_compile_deep 20 +%_python_compile_skip_x 1 +%_python_compile_clean 1 + +%set_python_req_method() %global _python_req_method %1 +%set_python_compile_method() %global _python_compile_method %1 + +%add_python_req_skip() %global _python_req_skip %_python_req_skip %* +%add_python_lib_path() %global _python_lib_path %_python_lib_path %* +%add_python_compile_exclude() %global _python_compile_exclude %_python_com= pile_exclude %* +%add_python_compile_include() %global _python_compile_include %_python_com= pile_include %* =20 # _check_python_version_internal <=D7=C5=D2=D3=C9=D1_=D3_=D4=CF=DE=CB=CF= =CA> <=D7=C5=D2=D3=C9=D1_=C2=C5=DA_=D4=CF=DE=CB=C9> # diff --git a/rpm-build-python/python.buildreq b/rpm-build-python/python.bui= ldreq new file mode 100644 index 0000000..4e323a7 --- /dev/null +++ b/rpm-build-python/python.buildreq @@ -0,0 +1,3 @@ +^/usr/.*/python.*/encodings/__init__\.py +^/usr/.*/python.*/encodings/aliases\.py +^/usr/.*/python.*/encodings/ascii\.py diff --git a/rpm-build-python/python.env b/rpm-build-python/python.env new file mode 100644 index 0000000..a046544 --- /dev/null +++ b/rpm-build-python/python.env @@ -0,0 +1,12 @@ +%{?_python_lib_path:export RPM_PYTHON_LIB_PATH=3D"%_python_lib_path"} +%{?_python_module_declared:export RPM_PYTHON_MODULE_DECLARED=3D"%_python_m= odule_declared"} +%{?_python_req_hier:export RPM_PYTHON_REQ_HIER=3D"%_python_req_hier"} +%{?_python_req_method:export RPM_PYTHON_REQ_METHOD=3D"%_python_req_method"} +%{?_python_req_skip:export RPM_PYTHON_REQ_SKIP=3D"%_python_req_skip"} +%{?_python_compile_method:export RPM_PYTHON_COMPILE_METHOD=3D"%_python_com= pile_method"} +%{?_python_compile_exclude:export RPM_PYTHON_COMPILE_EXCLUDE=3D"%_python_c= ompile_exclude"} +%{?_python_compile_include:export RPM_PYTHON_COMPILE_INCLUDE=3D"%_python_c= ompile_include"} +%{?_python_compile_deep:export RPM_PYTHON_COMPILE_DEEP=3D"%_python_compile= _deep"} +%{?_python_compile_skip_x:export RPM_PYTHON_COMPILE_SKIP_X=3D"%_python_com= pile_skip_x"} +%{?_python_compile_clean:export RPM_PYTHON_COMPILE_CLEAN=3D"%_python_compi= le_clean"} +%{?__python:export RPM_PYTHON=3D"%__python"} diff --git a/rpm-build-python/python.prov b/rpm-build-python/python.prov new file mode 100755 index 0000000..309a1fd --- /dev/null +++ b/rpm-build-python/python.prov @@ -0,0 +1,2 @@ +#!/bin/sh +LC_ALL=3DC exec "${RPM_PYTHON:-python}" "$0".py ${1+"$@"} diff --git a/rpm-build-python/python.prov.files b/rpm-build-python/python.p= rov.files new file mode 100755 index 0000000..96db153 --- /dev/null +++ b/rpm-build-python/python.prov.files @@ -0,0 +1,11 @@ +#!/bin/sh -efu +while IFS=3D$'\t' read -r f t; do + case "$f" in + *.py|*.pyo|*.pyc|*.pth) + echo "$f" + continue ;; + ${RPM_BUILD_ROOT-}*/python*/*.so) + echo "$f" + continue ;; + esac +done diff --git a/rpm-build-python/python.prov.py b/rpm-build-python/python.prov= .py index 049506b..23dd79e 100755 --- a/rpm-build-python/python.prov.py +++ b/rpm-build-python/python.prov.py @@ -52,7 +52,7 @@ def paths_from_pthfiles(prefix, buildroot, filenames): try : import sys, os except : - pass + raise else : =20 prefix =3D "python%u.%u" % sys.version_info[0:2] =20 diff --git a/rpm-build-python/python.req b/rpm-build-python/python.req new file mode 100755 index 0000000..309a1fd --- /dev/null +++ b/rpm-build-python/python.req @@ -0,0 +1,2 @@ +#!/bin/sh +LC_ALL=3DC exec "${RPM_PYTHON:-python}" "$0".py ${1+"$@"} diff --git a/rpm-build-python/python.req.files b/rpm-build-python/python.re= q.files new file mode 100755 index 0000000..bbbb4a6 --- /dev/null +++ b/rpm-build-python/python.req.files @@ -0,0 +1,15 @@ +#!/bin/sh -efu +while IFS=3D$'\t' read -r f t; do + case "$t" in + *"python script text"*) + echo "$f" + continue ;; + *"symbolic link to "*) + continue ;; + esac + case "$f" in + *.py) + echo "$f" + continue ;; + esac +done diff --git a/rpm-build-python/python.req.py b/rpm-build-python/python.req.py index c0ace61..43682d0 100755 --- a/rpm-build-python/python.req.py +++ b/rpm-build-python/python.req.py @@ -36,7 +36,7 @@ try : import sys, os import parser, symbol, token, types except : - pass =20 + raise else : =20 def _(s) : return s prefix =3D "python%u.%u" % sys.version_info[0:2] @@ -50,38 +50,51 @@ else : if sys.version_info[0:2] < (2,4) : def pro(x) : return x + def namelist(import_node) : + return [x for x in import_node[2:] if x[0] !=3D 12 ] else : def pro(x) : return x[1] - =20 + def namelist(import_node) : + return [x for x in import_node[2][1:] if x[0] !=3D 12 ] + ignore =3D dict([ (x,1) for x in=20 list(os.getenv('RPM_PYTHON_REQ_SKIP',"").split()) + list(sys.builtin_module_names)]).has_key =20 REQ=3Dos.getenv('RPM_PYTHON_REQ_METHOD','relaxed') IS_HIER =3D os.getenv('RPM_PYTHON_REQ_HIER',None) + src =3D None def match(tree,deep=3D0) : if tree[0] not in symbol_skip : deep +=3D 1 for node in tree : if type(node) in [types.ListType, types.TupleType] : if node[0] =3D=3D symbol.import_stmt : - if REQ not in ['slight','relaxed'] or deep =3D=3D 4 : - node =3D pro(node) - if node[1][1] =3D=3D 'import' : - for name in [x for x in node[2:] if x[0] !=3D = 12 ] : - name =3D pro(name) - =20 - if IS_HIER is None : - yield name[1][1][1] - else : - yield ".".join( [ i for t,i in name[1= ][1:] if t=3D=3D1 ]) - elif node[1][1] =3D=3D 'from' : + line =3D 0 + deps =3D [] + node =3D pro(node) + if node[1][1] =3D=3D 'import' : + line =3D node[1][2] + for name in namelist(node) : if IS_HIER is None : - yield node[2][1][1] + deps.append(name[1][1][1]) else : - yield ".".join( [ i for t,i in node[2][1:= ] if t=3D=3D1 ]) - =20 + deps.append(".".join( [ i for t,i in name= [1][1:] if t=3D=3D1 ])) + elif node[1][1] =3D=3D 'from' : + line =3D node[1][2] + if IS_HIER is None : + deps.append(node[2][1][1]) + else : + deps.append(".".join( [ i for t,i in node[2][= 1:] if t=3D=3D1 ])) + + if REQ not in ['slight','relaxed'] or deep =3D=3D 4 : + for dep in deps : + yield dep + else : + for dep in deps: + print >> sys.stderr, "%s: %s: line=3D%d IGNORE= module=3D%s" % (sys.argv[0], src, line, dep) + for item in match(node,deep) : yield item =20 @@ -115,9 +128,9 @@ else : # print "\t",req =20 for src in files : - if '.py' =3D=3D os.path.splitext(os.path.basename(src))[1] : + #if '.py' =3D=3D os.path.splitext(os.path.basename(src))[1] : try : - lis =3D parser.suite(open(src).read().replace("\r\n","= \n")).tolist() + lis =3D parser.suite(open(src).read().replace("\r\n","= \n")).tolist(line_info=3D1) except SyntaxError,msg : continue except : --mpb+VUhBqKoEsre9 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFGAPrifBKgtDjnu0YRAtueAKCvvrSknsNoz2T2EeJt1HY4f+21oQCghg7U Xdio0ec0JqR05gjalpX/GwE= =rzf0 -----END PGP SIGNATURE----- --mpb+VUhBqKoEsre9--