From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 19 Mar 2007 21:24:04 +0300 From: Alexey Tourbin To: ALT Devel discussion list Message-ID: <20070319182404.GJ5965@solemn.turbinal> Mail-Followup-To: ALT Devel discussion list References: <87bqiqpnjf.fsf@vertex.dottedmag.net> <20070318154750.GW6039@solemn.turbinal> <877itepn05.fsf@vertex.dottedmag.net> <20070318155916.GX6039@solemn.turbinal> <871wjmpm6n.fsf@vertex.dottedmag.net> <20070318162139.GY6039@solemn.turbinal> <87ejnmo6qr.fsf@vertex.dottedmag.net> <20070318170049.GB4546@hell.immo.ru> <20070318182828.GA6039@solemn.turbinal> <45FECE14.5050805@neural.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GlnCQLZWzqLRJED8" Content-Disposition: inline In-Reply-To: <45FECE14.5050805@neural.ru> Subject: Re: [devel] python-modules-encodings 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: Mon, 19 Mar 2007 18:25:42 -0000 Archived-At: List-Archive: List-Post: --GlnCQLZWzqLRJED8 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Mar 20, 2007 at 01:53:24AM +0800, Ivan Fedorov wrote: > Alexey Tourbin =D0=C9=DB=C5=D4: > > =EE=C1=D7=C5=D2=CE=CF=C5, =CE=D5=D6=CE=CF =DA=C1=C8=C1=DE=C9=D4=D8 =D0= =C9=D4=CF=CE, =DE=D4=CF=C2=D9 =CF=CE =CE=C5 =DA=C1=C7=D2=D5=D6=C1=CC encodi= ngs, =C5=D3=CC=C9 > > =DA=C1=D0=D5=DD=C5=CE =D0=CF=C4 buildreq'=CF=CD. >=20 > =EE=D5 =D7=CF=D4 =D4=C1=CB=CF=C7=CF =DA=D7=C5=D2=D3=D4=D7=C1 =CE=C5 =CE= =C1=C4=CF!!! =E8=CF=D2=CF=DB=CF. =F1 =D0=D2=C9=C4=D5=CD=C1=CC =D0=D2=CF=CD=C5=D6=D5=D4=CF=DE=CE=CF=C5 =D2=C5= =DB=C5=CE=C9=C5 =CE=C1 =D5=D2=CF=D7=CE=C5 rpm-build-python =C9 buildreq. commit 80cc60b7525cd1fcbb85df6f91a02e2e09ef0a6e Author: Alexey Tourbin Date: Mon Mar 19 21:12:54 2007 +0300 deal with build dependencies on python-modules-encodings =20 If you run buildreq and if you have python-modules-encodings installed, buildreq will always yield python-modules-encodings. However, if python-modules-encodings is missing, that's okay (most of the time). =20 $ packagereq -o /dev/stdout rpm --eval %__python_version 2.4 packagereq: building requires list: python-modules-encodings python-modules-encodings $ =20 The problem is in the following code: =20 Python/Python/codecs.c 834 mod =3D PyImport_ImportModuleEx("encodings", NULL, NULL, NU= LL); 835 if (mod =3D=3D NULL) { 836 if (PyErr_ExceptionMatches(PyExc_ImportError)) { 837 /* Ignore ImportErrors... this is done so that 838 distributions can disable the encodings package.= Note 839 that other errors are not masked, e.g. SystemErr= ors 840 raised to inform the user of an error in the Pyt= hon 841 configuration are still reported back to the use= r. */ 842 PyErr_Clear(); 843 return 0; 844 } 845 return -1; 846 } =20 And there's no switch like "assume no encodings available at startup". =20 Now I still don't want buildreq to yield python-modules-encodings only because I evaluate %__python_version macro. =20 The solution is as follows: =20 1) everywhere from rpm-build-python run python with LC_ALL=3DC. 2) add encoding files loaded under LC_ALL=3DC to buildreq skiplist. =20 New behaviour: =20 $ packagereq -o /dev/stdout rpm --eval %__python_version 2.4 packagereq: building requires list: python-base python-base $ diff --git a/rpm-build-python.spec b/rpm-build-python.spec index a3da4b1..cf5c5aa 100644 --- a/rpm-build-python.spec +++ b/rpm-build-python.spec @@ -39,6 +39,7 @@ subst 's/@PYTHON_VERSION@/%__python_version/g' python %install install -pD -m644 python %buildroot%_sysconfdir/rpm/macros.d/python 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%_target_libdir/rpm/python.prov install -pD -m755 python.prov.py %buildroot%_target_libdir/rpm/python.prov= .py install -pD -m755 python.prov.files %buildroot%_target_libdir/rpm/python.p= rov.files @@ -62,6 +63,7 @@ unset RPM_PYTHON %files %_sysconfdir/rpm/macros.d/python %_sysconfdir/rpm/macros.d/python.env +%_sysconfdir/buildreqs/files/ignore.d/%name %_target_libdir/rpm/python.compileall.py %_target_libdir/rpm/python.req %_target_libdir/rpm/python.req.py diff --git a/rpm-build-python/python b/rpm-build-python/python index 8b49990..af9a622 100644 --- a/rpm-build-python/python +++ b/rpm-build-python/python @@ -2,7 +2,7 @@ # -*- 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@) =20 %_python_lib_path "" %_python_req_method slight 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.prov b/rpm-build-python/python.prov index cdca9e4..309a1fd 100755 --- a/rpm-build-python/python.prov +++ b/rpm-build-python/python.prov @@ -1,2 +1,2 @@ #!/bin/sh -exec "${RPM_PYTHON:-python}" "$0".py ${1+"$@"} +LC_ALL=3DC exec "${RPM_PYTHON:-python}" "$0".py ${1+"$@"} diff --git a/rpm-build-python/python.req b/rpm-build-python/python.req index cdca9e4..309a1fd 100755 --- a/rpm-build-python/python.req +++ b/rpm-build-python/python.req @@ -1,2 +1,2 @@ #!/bin/sh -exec "${RPM_PYTHON:-python}" "$0".py ${1+"$@"} +LC_ALL=3DC exec "${RPM_PYTHON:-python}" "$0".py ${1+"$@"} --GlnCQLZWzqLRJED8 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFF/tVEfBKgtDjnu0YRArZzAJ9PzF9oFXutWXm42zK2EA0dBxA8HACg2TYd WxHiTBG9DHKboDYOPe6HIrw= =NeWE -----END PGP SIGNATURE----- --GlnCQLZWzqLRJED8--