ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Alexey Tourbin <at@altlinux.ru>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] python-modules-encodings
Date: Mon, 19 Mar 2007 21:24:04 +0300
Message-ID: <20070319182404.GJ5965@solemn.turbinal> (raw)
In-Reply-To: <45FECE14.5050805@neural.ru>

[-- Attachment #1: Type: text/plain, Size: 4826 bytes --]

On Tue, Mar 20, 2007 at 01:53:24AM +0800, Ivan Fedorov wrote:
> Alexey Tourbin пишет:
> > Наверное, нужно захачить питон, чтобы он не загружал encodings, если
> > запущен под buildreq'ом.
> 
> Ну вот такого зверства не надо!!!

Хорошо.
Я придумал промежуточное решение на уровне rpm-build-python и buildreq.

commit 80cc60b7525cd1fcbb85df6f91a02e2e09ef0a6e
Author: Alexey Tourbin <at@altlinux>
Date:   Mon Mar 19 21:12:54 2007 +0300

    deal with build dependencies on python-modules-encodings
    
    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).
    
    $ packagereq -o /dev/stdout rpm --eval %__python_version
    2.4
    packagereq: building requires list: python-modules-encodings
    python-modules-encodings
    $
    
    The problem is in the following code:
    
    Python/Python/codecs.c
       834      mod = PyImport_ImportModuleEx("encodings", NULL, NULL, NULL);
       835      if (mod == 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. SystemErrors
       840                 raised to inform the user of an error in the Python
       841                 configuration are still reported back to the user. */
       842              PyErr_Clear();
       843              return 0;
       844          }
       845          return -1;
       846      }
    
    And there's no switch like "assume no encodings available at startup".
    
    Now I still don't want buildreq to yield python-modules-encodings
    only because I evaluate %__python_version macro.
    
    The solution is as follows:
    
    1) everywhere from rpm-build-python run python with LC_ALL=C.
    2) add encoding files loaded under LC_ALL=C to buildreq skiplist.
    
    New behaviour:
    
    $ 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/ignore.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.prov.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 -*-
 
 # Override __python_version macro provided by rpm-build 
-%__python_version	%(%__python -c 'import sys; print "%%u.%%u" %% sys.version_info[0:2]' 2>/dev/null || echo @PYTHON_VERSION@)
+%__python_version	%(LC_ALL=C %__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
diff --git a/rpm-build-python/python.buildreq b/rpm-build-python/python.buildreq
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=C 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=C exec "${RPM_PYTHON:-python}" "$0".py ${1+"$@"}

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2007-03-19 18:24 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-15  5:56 [devel] [git update] packages/python: heads/master Alexey M. Tourbin
2007-03-15  9:12 ` Alexey I. Froloff
2007-03-15  9:14   ` Aleksey Avdeev
2007-03-15  9:36     ` Ivan Fedorov
2007-03-15  9:33       ` Aleksey Avdeev
2007-03-15  9:50         ` Ivan Fedorov
2007-03-15  9:57           ` Aleksey Avdeev
2007-03-15 10:15             ` Ivan Fedorov
2007-03-18 22:10           ` [devel] [JT] python policy и отношение к коллегам Michael Shigorin
2007-03-18 22:25             ` Dmitry V. Levin
2007-03-19 18:04               ` Ivan Fedorov
2007-03-19 18:03             ` Ivan Fedorov
2007-03-19 18:29               ` Alexey I. Froloff
2007-03-19 18:34                 ` Ivan Fedorov
2007-03-19 18:52                   ` Alexey I. Froloff
2007-03-19 19:08                     ` Ivan Fedorov
2007-03-19 19:16                       ` Alexey I. Froloff
2007-03-19 20:03                         ` Ivan Fedorov
2007-03-19 20:30                           ` Alexey I. Froloff
2007-03-19 21:26                             ` Денис Смирнов
2007-03-19 22:20                               ` Alexey I. Froloff
2007-03-19 22:23                                 ` Konstantin Pavlov
2007-03-19 22:40                                 ` Dmitry V. Levin
2007-03-19 23:23                                   ` Alexey I. Froloff
2007-03-20  9:08                                     ` Денис Смирнов
2007-03-20  9:16                                       ` Ivan Fedorov
2007-03-20  9:37                                         ` Денис Смирнов
2007-03-19 21:14                         ` Денис Смирнов
2007-03-15  9:41       ` [devel] [git update] packages/python: heads/master Mikhail Gusarov
2007-03-15  9:43         ` Ivan Fedorov
2007-03-15  9:45           ` Mikhail Gusarov
2007-03-15 20:03       ` Konstantin A. Lepikhov
2007-03-15  9:38     ` Mikhail Gusarov
2007-03-18 15:37   ` [devel] python-modules-encodings Alexey Tourbin
2007-03-18 15:41     ` Mikhail Gusarov
2007-03-18 15:47       ` Alexey Tourbin
2007-03-18 15:52         ` Mikhail Gusarov
2007-03-18 15:59           ` Alexey Tourbin
2007-03-18 16:10             ` Mikhail Gusarov
2007-03-18 16:21               ` Alexey Tourbin
2007-03-18 16:29                 ` Mikhail Gusarov
2007-03-18 17:00                   ` Alexey I. Froloff
2007-03-18 18:28                     ` Alexey Tourbin
2007-03-18 20:10                       ` Mikhail Gusarov
2007-03-19 22:23                         ` [devel] buildreq Dmitry V. Levin
2007-03-18 21:38                       ` [devel] python-modules-encodings Alexey I. Froloff
2007-03-19 17:53                       ` Ivan Fedorov
2007-03-19 18:24                         ` Alexey Tourbin [this message]
2007-03-19 18:42                           ` Ivan Fedorov
2007-03-19 18:51                             ` Alexey Tourbin
2007-03-19 19:12                               ` Ivan Fedorov
2007-03-19 19:36                                 ` Alexey Tourbin
2007-03-19 19:58                                   ` Ivan Fedorov
2007-03-18 17:02                   ` Michael Shigorin
2007-03-19 17:54                     ` Ivan Fedorov
2007-03-19 21:25                       ` [devel] buildreq += autoignore Michael Shigorin
2007-03-19 21:36                         ` Alexey Tourbin
2007-03-19 21:56                           ` Alexey I. Froloff
2007-03-19 22:03                             ` Alexey Tourbin
2007-03-19 22:13                               ` Michael Shigorin
2007-03-19 22:21                                 ` Alexey Tourbin
2007-03-19 22:28                                   ` Dmitry V. Levin
2007-03-19 22:34                                     ` Michael Shigorin
2007-03-20 17:11                                       ` Igor Zubkov
2007-03-20 17:13                                         ` Alexey Tourbin
2007-03-20 17:16                                           ` Igor Zubkov
2007-03-19 22:43                                     ` Motsyo Gennadi aka Drool
2007-03-19 22:48                                       ` Dmitry V. Levin
2007-03-19 23:00                                         ` Motsyo Gennadi aka Drool
2007-03-19 23:08                                           ` Alexey Tourbin
2007-03-29 22:26                           ` [devel] [FR] buildreq: non-pruned deps as a spec comment Michael Shigorin
2007-03-29 22:51                             ` [devel] " Alexey Tourbin
2007-03-30  7:52                               ` Michael Shigorin
2007-03-18 16:54       ` [devel] python-modules-encodings Michael Shigorin
2007-03-18 20:11         ` Mikhail Gusarov
2007-03-18 15:52     ` Alexey I. Froloff
2007-03-18 18:12     ` Alexey Tourbin
2007-03-19 16:35     ` Alexey Morsov
2007-03-19 16:39       ` Alexey Tourbin
2007-03-19 17:05         ` Alexey Morsov
2007-03-15  9:43 ` [devel] [git update] packages/python: heads/master Ivan Fedorov
2007-03-15 10:55   ` Alexey Tourbin
2007-03-15 11:37     ` Ivan Fedorov
2007-03-15 12:11       ` Alexey Tourbin
2007-03-15 12:47         ` Ivan Fedorov
2007-03-15 12:57           ` Alexey I. Froloff
2007-03-15 13:19           ` Alexey Tourbin
2007-03-15 13:32             ` Ivan Fedorov
2007-03-15 13:19           ` Dmitry V. Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070319182404.GJ5965@solemn.turbinal \
    --to=at@altlinux.ru \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git