From 8f6f083090bc2bf84d0df17c292c796ac8ea8853 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Mon, 8 Apr 2013 14:20:23 +0400 Subject: Create python2.7-minimal proto --- python2.7/Makefile | 47 +++++++- python2.7/debian/PVER-minimal.README.Debian.in | 147 +++++++++++++++++++++++++ 2 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 python2.7/debian/PVER-minimal.README.Debian.in diff --git a/python2.7/Makefile b/python2.7/Makefile index 806ebac..a0ca066 100644 --- a/python2.7/Makefile +++ b/python2.7/Makefile @@ -2,6 +2,8 @@ include /usr/share/cibs/rules/ips.mk include /usr/share/cibs/rules/autotools.mk include /usr/share/cibs/rules/archive.mk +movefiles := /usr/share/cibs/scripts/movefiles + $(eval $(call add-variant,default)) %-default-stamp: bits = 64 @@ -16,6 +18,8 @@ home := http://www.python.org/ archive := $(name)-$(version).tar.bz2 download := http://www.python.org/ftp/python/$(version)/$(archive) +PVER := python$(pyver) + checksum-Python-2.7.3.tar.bz2 := \ md5:c57477edd6d18bd9eeca2f21add73919 \ sha1:842c4e2aff3f016feea3c6e992c7fa96e49c9aa0 \ @@ -46,6 +50,21 @@ configure-options += \ --with-system-ffi \ --enable-shared \ +MIN_MODS := $(shell awk '/^ / && $$2 == "module" { print $$1 }' \ + debian/PVER-minimal.README.Debian.in) +MIN_EXTS := $(shell awk '/^ / && $$2 ~ /^extension/ { print $$1 }' \ + debian/PVER-minimal.README.Debian.in) +MIN_BUILTINS := $(shell awk '/^ / && $$2 == "builtin" { print $$1 }' \ + debian/PVER-minimal.README.Debian.in) +MIN_PACKAGES := $(shell awk '/^ / && $$2 == "package" { print $$1 }' \ + debian/PVER-minimal.README.Debian.in) +MIN_ENCODINGS := $(foreach i, \ + $(filter-out \ + big5% bz2% cp932.py cp949.py cp950.py euc_% \ + gb% iso2022% johab.py shift_jis% , \ + $(shell cd $(sourcedir)/Lib/encodings && echo *.py)), \ + encodings/$(i)) \ + codecs.py stringprep.py # We install libpython.X.Y.so.* in usual place (libdir), # but runtime libraries go into the place where python @@ -56,8 +75,9 @@ install-default-stamp: make-vars += \ # Shorter name: d := $(protodir.default) -scriptdir = usr/lib/python$(VER) +scriptdir = usr/lib/python$(VER) VER := $(pyver) +d_min := work/proto/python2.7-minimal install-stamp: postinst-stamp postinst-stamp: install-default-stamp @@ -69,6 +89,8 @@ postinst-stamp: install-default-stamp rm -f $(d)/usr/lib/pkgconfig/python.pc rm -f $(d)/usr/bin/python2{,-config} rm -f $(d)/usr/share/man/man1/python2{,-config}.1 + gfind $(d) -name 'wininst*.exe' | gxargs -r rm -f + : # Symlinks to /usr/bin for some tools ln -sf ../lib/python$(VER)/pdb.py $(d)/usr/bin/pdb$(VER) : # versioned install only @@ -86,5 +108,28 @@ postinst-stamp: install-default-stamp $(d)/usr/bin/2to3-$(VER) \ > $(d)/usr/share/man/man1/2to3-$(VER).1 + : # install minimal set: + mkdir -p $(d_min) + cd $(d_min) && mkdir -p \ + etc/$(PVER) \ + usr/bin \ + usr/include/$(PVER) \ + usr/share/man/man1 \ + $(scriptdir)/lib-dynload \ + $(scriptdir)/config + $(movefiles) -s $(d) -d$(d_min) \ + usr/bin/python$(VER) \ + usr/share/man/man1/python$(VER).1 \ + $(foreach i,$(MIN_MODS),$(scriptdir)/$(i).py) \ + $(foreach i,$(MIN_PACKAGES),$(scriptdir)/$(i)) \ + $(foreach i,$(MIN_ENCODINGS),$(scriptdir)/$(i)) \ + $(scriptdir)/config/Makefile \ + usr/include/$(PVER)/pyconfig.h \ + $(scriptdir)/site.py \ + $(shell cd $(d); for i in $(MIN_EXTS); do \ + test -e $(scriptdir)/lib-dynload/$$i.so \ + && echo $(scriptdir)/lib-dynload/$$i.so; \ + done; true) + touch $@ diff --git a/python2.7/debian/PVER-minimal.README.Debian.in b/python2.7/debian/PVER-minimal.README.Debian.in new file mode 100644 index 0000000..fc0abc9 --- /dev/null +++ b/python2.7/debian/PVER-minimal.README.Debian.in @@ -0,0 +1,147 @@ +Contents of the @PVER@-minimal package +----------------------------------------- + +@PVER@-minimal consists of a minimum set of modules which may be needed +for python scripts used during the boot process. If other packages +are needed in these scripts, don't work around the missing module, but +file a bug report against this package. The modules in this package +are: + + __builtin__ builtin + __future__ module + _abcoll module + _bisect extension + _bytesio extension + _codecs builtin + _collections extension + _fileio extension + _functools extension + _hashlib extensionx + _heapq extension + _locale extension + _random extension + _socket extension + _sre builtin + _ssl extensionx + _struct extension + _symtable builtin + _sysconfigdata module + _sysconfigdata_nd module + _types builtin + _warnings builtin + _weakref extension + _weakrefset module + abc module + atexit module + ConfigParser module + StringIO module + UserDict module + cPickle extension + cStringIO extension + array extension + base64 module + binascii extension + bisect module + cmath extension + codecs module + collections module + compileall module + copy module + copy_reg module + dis module + errno builtin + exceptions builtin + fcntl extension + fnmatch module + functools module + gc builtin + genericpath module + getopt module + glob module + grp extension + hashlib module + heapq module + imp builtin + inspect module + itertools extension + keyword module + linecache module + logging package + marshal builtin + math extension + md5 module + opcode module + operator extension + optparse module + os module + pickle module + platform module + popen2 module + posix builtin + posixpath module + pkgutil module + pwd builtin + py_compile module + random module + re module + repr module + runpy module + select extension + sha module + shutil module + signal builtin + socket module + spwd extension + sre module + sre_compile module + sre_constants module + sre_parse module + ssl module + stat module + string module + strop extension + struct module + subprocess module + sys builtin + syslog extension + sysconfig module + tempfile module + textwrap module + time extension + token module + thread builtin + token module + tokenize module + traceback module + types module + unicodedata extension + weakref module + warnings module + zipimport extension + zlib extension + +Included are as well the codecs and stringprep modules, and the encodings +modules for all encodings except the multibyte encodings and the bz2 codec. + +The following modules are excluded, their import is guarded from the +importing module: + + Used in Excluded + ------------ ------------------------------------ + os nt ntpath os2 os2emxpath mac macpath + riscos riscospath riscosenviron + optparse gettext + pickle doctest + subprocess threading + +This list was derived by looking at the modules in the perl-base package, +then adding python specific "core modules". + +TODO's +------ + +- time.strptime cannot be used. The required _strptime module is not + included in the -minimal package yet. _strptime, locale, _locale and + calendar have to be added. + +- modules used very often in the testsuite: copy, cPickle, operator. -- cgit v1.2.3