Opened 4 weeks ago

Last modified 3 weeks ago

#836 new defect

export PYTHONOPTIMIZE=2 breaks make install

Reported by: Дилян Палаузов Owned by: Richard Boulton
Priority: normal Milestone: 1.4.27
Component: Xapian-bindings (Python) Version: 1.4.26
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description

In my chroot/virtualenv I use only PYTHONOPTIMIZE=2, so I want to utilize it also when installing xapian-bindings for python3. Calling

export PYTHONOPTIMIZE=2
./configure --with-python3 --prefix=/home/mailmanweb PYTHON3_LIB=/home/mailmanweb/lib/python3.10/site-packages
make install

fails with

 /usr/bin/mkdir -p '/home/mailmanweb/lib/python3.10/site-packages/xapian'
 /usr/bin/install -c -m 644 xapian/__init__.py ../../python3/xapian/__pycache__/__init__.cpython-310.pyc xapian/__pycache__/__init__.cpython-310.opt-2.pyc '/home/mailmanweb/lib/python3.10/site-packages/xapian'
/usr/bin/install: cannot stat '../../python3/xapian/__pycache__/__init__.cpython-310.pyc': No such file or directory
make[4]: *** [Makefile:822: install-pkgpylibDATA] Error 1

Indeed, make has created python3/xapian/__pycache__/__init__.cpython-310.opt-2.pyc and there is no python3/xapian/__pycache__/__init__.cpython-310.pyc file.

Change History (2)

comment:1 by Olly Betts, 4 weeks ago

Milestone: 1.4.27
Version: 1.4.26

It looks like the problem here is that forcing PYTHONOPTIMIZE=2 also affects the command which is trying to generate an unoptimised .pyc and we instead generate xapian/__pycache__/__init__.cpython-312.opt-2.pyc twice.

The simplest fix is probably for us to override PYTHONOPTIMIZE for that command.

If you want a workaround for current releases then not setting PYTHONOPTIMIZE=2 and doing sed -i 's/$(PYTHON3) -O/&2/' python3/Makefile after configure but before make should work.

comment:2 by Дилян Палаузов, 3 weeks ago

The simplest fix is probably for us to override PYTHONOPTIMIZE for that command.

I want to install __pycache__/__init__.cpython-310.opt-2.pyc and not to create or install __pycache__/__init__.cpython-310.pyc.

Note: See TracTickets for help on using tickets.