Re: devel/boost: drop python2 support and speed up make fake

2020-11-15 Thread Brad Smith

On 11/13/2020 6:33 PM, Stuart Henderson wrote:

On 2020/11/13 17:41, Jeremie Courreges-Anglas wrote:

On Fri, Nov 13 2020, Stuart Henderson  wrote:

On 2020/11/08 01:46, Jeremie Courreges-Anglas wrote:

This diff drops boost_python27 and boost_numpy27.

Dropping boost_python27* needs work first;

That is correct, I had a draft mail about it but ENOTIME.
tl;dr my grep-fu failed me, sorry folks.

This is what I came up with to disable just boost_numpy27.  A bit
hackish but seems to work fine.

BTW the only failure in an i386 build with the original diff was
py-tagpy (openimageio is broken on at least i386/powerpc, and
vegastrike is amd64-only as one of the deps is broken on i386).
Nothing on i386 had problems with removing the b2 files.

I've sent out a py-tagpy diff, openimageio is literally just
MODPY_VERSION = ${MODPY_DEFAULT_VERSION_3} and bump REVISION (I'm
building blender with it to be sure, which will take a while, but
unlikely to have any problems). I think those two make sense
regardless.

Then we can either go for your new diff, or the original one and
mark vegastrike broken for now..


I'd prefer if we go with the original diff.



Re: devel/boost: drop python2 support and speed up make fake

2020-11-13 Thread Stuart Henderson
On 2020/11/13 17:41, Jeremie Courreges-Anglas wrote:
> On Fri, Nov 13 2020, Stuart Henderson  wrote:
> > On 2020/11/08 01:46, Jeremie Courreges-Anglas wrote:
> >> 
> >> This diff drops boost_python27 and boost_numpy27.
> >
> > Dropping boost_python27* needs work first;
> 
> That is correct, I had a draft mail about it but ENOTIME.
> tl;dr my grep-fu failed me, sorry folks.
> 
> This is what I came up with to disable just boost_numpy27.  A bit
> hackish but seems to work fine.

BTW the only failure in an i386 build with the original diff was
py-tagpy (openimageio is broken on at least i386/powerpc, and
vegastrike is amd64-only as one of the deps is broken on i386).
Nothing on i386 had problems with removing the b2 files.

I've sent out a py-tagpy diff, openimageio is literally just
MODPY_VERSION = ${MODPY_DEFAULT_VERSION_3} and bump REVISION (I'm
building blender with it to be sure, which will take a while, but
unlikely to have any problems). I think those two make sense
regardless.

Then we can either go for your new diff, or the original one and
mark vegastrike broken for now..

> ===
> RCS file: /cvs/ports/devel/boost/Makefile,v
> retrieving revision 1.102
> diff -u -p -r1.102 Makefile
> --- Makefile  11 Nov 2020 15:53:41 -  1.102
> +++ Makefile  13 Nov 2020 16:38:52 -
> @@ -6,6 +6,7 @@ COMMENT-main= free peer-reviewed portabl
>  COMMENT-md=  machine-dependent libraries for boost
>  
>  VERSION= 1.70.0
> +REVISION-main=   0
>  DISTNAME=boost_${VERSION:S/./_/g}
>  PKGNAME-main=boost-${VERSION}
>  PKGNAME-md=  boost-md-${VERSION}
> @@ -33,7 +34,6 @@ BOOST_LIBS= boost_atomic-mt \
>   boost_math_tr1l-mt boost_math_tr1l \
>   boost_prg_exec_monitor-mt boost_prg_exec_monitor \
>   boost_program_options-mt boost_program_options \
> - boost_numpy27-mt boost_numpy27 \
>   boost_numpy38-mt boost_numpy38 \
>   boost_python27-mt boost_python27 \
>   boost_python38-mt boost_python38 \
> @@ -82,8 +82,7 @@ MODULES=lang/python
>  MODPY_RUNDEP=No
>  
>  # extras needed until py2 support can be removed
> -BUILD_DEPENDS+=  math/py-numpy \
> - math/py-numpy,python3 \
> +BUILD_DEPENDS+=  math/py-numpy,python3 \
>   lang/python/${MODPY_DEFAULT_VERSION_3}
>  
>  LIB_DEPENDS= archivers/bzip2 \
> @@ -185,7 +184,10 @@ do-build:
>   # Second run of bootstrap/b2, setup for py2 environment:
>   sed 's;\(using python.*PYTHON_ROOT\).*;\1 : ${PY2_INC} \;;' \
>   < ${WRKSRC}/bootstrap.sh > ${WRKSRC}/bootstrap.sh.tmp
> - cd ${WRKSRC} && export ${MAKE_ENV} && \
> +  # dummy numpy module that will fail autodetection
> + mkdir -p ${WRKDIR}/dummy
> + touch ${WRKDIR}/dummy/numpy.py
> + cd ${WRKSRC} && export ${MAKE_ENV} PYTHONPATH="${WRKDIR}/dummy:" && \
>   /bin/sh ./bootstrap.sh.tmp ${BOOTSTRAP} ${PY2_BOOTSTRAP} && \
>   ./b2 ${BJAM_CONFIG} python=${MODPY_DEFAULT_VERSION_2}
>  
> Index: pkg/PLIST-main
> ===
> RCS file: /cvs/ports/devel/boost/pkg/PLIST-main,v
> retrieving revision 1.10
> diff -u -p -r1.10 PLIST-main
> --- pkg/PLIST-main5 Nov 2020 11:23:03 -   1.10
> +++ pkg/PLIST-main13 Nov 2020 16:38:52 -
> @@ -15088,10 +15088,6 @@ include/boost/yap/yap.hpp
>  @lib lib/libboost_math_tr1l-mt.so.${LIBboost_math_tr1l-mt_VERSION}
>  @static-lib lib/libboost_math_tr1l.a
>  @lib lib/libboost_math_tr1l.so.${LIBboost_math_tr1l_VERSION}
> -@static-lib lib/libboost_numpy27-mt.a
> -@lib lib/libboost_numpy27-mt.so.${LIBboost_numpy27-mt_VERSION}
> -@static-lib lib/libboost_numpy27.a
> -@lib lib/libboost_numpy27.so.${LIBboost_numpy27_VERSION}
>  @static-lib lib/libboost_numpy38-mt.a
>  @lib lib/libboost_numpy38-mt.so.${LIBboost_numpy38-mt_VERSION}
>  @static-lib lib/libboost_numpy38.a
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 



Re: devel/boost: drop python2 support and speed up make fake

2020-11-13 Thread Jeremie Courreges-Anglas
On Fri, Nov 13 2020, Stuart Henderson  wrote:
> On 2020/11/08 01:46, Jeremie Courreges-Anglas wrote:
>> 
>> This diff drops boost_python27 and boost_numpy27.
>
> Dropping boost_python27* needs work first;

That is correct, I had a draft mail about it but ENOTIME.
tl;dr my grep-fu failed me, sorry folks.

This is what I came up with to disable just boost_numpy27.  A bit
hackish but seems to work fine.

Index: Makefile
===
RCS file: /cvs/ports/devel/boost/Makefile,v
retrieving revision 1.102
diff -u -p -r1.102 Makefile
--- Makefile11 Nov 2020 15:53:41 -  1.102
+++ Makefile13 Nov 2020 16:38:52 -
@@ -6,6 +6,7 @@ COMMENT-main=   free peer-reviewed portabl
 COMMENT-md=machine-dependent libraries for boost
 
 VERSION=   1.70.0
+REVISION-main= 0
 DISTNAME=  boost_${VERSION:S/./_/g}
 PKGNAME-main=  boost-${VERSION}
 PKGNAME-md=boost-md-${VERSION}
@@ -33,7 +34,6 @@ BOOST_LIBS=   boost_atomic-mt \
boost_math_tr1l-mt boost_math_tr1l \
boost_prg_exec_monitor-mt boost_prg_exec_monitor \
boost_program_options-mt boost_program_options \
-   boost_numpy27-mt boost_numpy27 \
boost_numpy38-mt boost_numpy38 \
boost_python27-mt boost_python27 \
boost_python38-mt boost_python38 \
@@ -82,8 +82,7 @@ MODULES=  lang/python
 MODPY_RUNDEP=  No
 
 # extras needed until py2 support can be removed
-BUILD_DEPENDS+=math/py-numpy \
-   math/py-numpy,python3 \
+BUILD_DEPENDS+=math/py-numpy,python3 \
lang/python/${MODPY_DEFAULT_VERSION_3}
 
 LIB_DEPENDS=   archivers/bzip2 \
@@ -185,7 +184,10 @@ do-build:
# Second run of bootstrap/b2, setup for py2 environment:
sed 's;\(using python.*PYTHON_ROOT\).*;\1 : ${PY2_INC} \;;' \
< ${WRKSRC}/bootstrap.sh > ${WRKSRC}/bootstrap.sh.tmp
-   cd ${WRKSRC} && export ${MAKE_ENV} && \
+# dummy numpy module that will fail autodetection
+   mkdir -p ${WRKDIR}/dummy
+   touch ${WRKDIR}/dummy/numpy.py
+   cd ${WRKSRC} && export ${MAKE_ENV} PYTHONPATH="${WRKDIR}/dummy:" && \
/bin/sh ./bootstrap.sh.tmp ${BOOTSTRAP} ${PY2_BOOTSTRAP} && \
./b2 ${BJAM_CONFIG} python=${MODPY_DEFAULT_VERSION_2}
 
Index: pkg/PLIST-main
===
RCS file: /cvs/ports/devel/boost/pkg/PLIST-main,v
retrieving revision 1.10
diff -u -p -r1.10 PLIST-main
--- pkg/PLIST-main  5 Nov 2020 11:23:03 -   1.10
+++ pkg/PLIST-main  13 Nov 2020 16:38:52 -
@@ -15088,10 +15088,6 @@ include/boost/yap/yap.hpp
 @lib lib/libboost_math_tr1l-mt.so.${LIBboost_math_tr1l-mt_VERSION}
 @static-lib lib/libboost_math_tr1l.a
 @lib lib/libboost_math_tr1l.so.${LIBboost_math_tr1l_VERSION}
-@static-lib lib/libboost_numpy27-mt.a
-@lib lib/libboost_numpy27-mt.so.${LIBboost_numpy27-mt_VERSION}
-@static-lib lib/libboost_numpy27.a
-@lib lib/libboost_numpy27.so.${LIBboost_numpy27_VERSION}
 @static-lib lib/libboost_numpy38-mt.a
 @lib lib/libboost_numpy38-mt.so.${LIBboost_numpy38-mt_VERSION}
 @static-lib lib/libboost_numpy38.a

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: devel/boost: drop python2 support and speed up make fake

2020-11-13 Thread Stuart Henderson
On 2020/11/08 01:46, Jeremie Courreges-Anglas wrote:
> 
> This diff drops boost_python27 and boost_numpy27.

Dropping boost_python27* needs work first;

sqlite> select * from wantlib where value like 'boost_python27%';
654|audio/py-tagpy|boost_python27-mt
4959|games/vegastrike/engine|boost_python27
5186|graphics/openimageio|boost_python27-mt


audio/py-tagpy: uses boost_python27-mt for the py2 flavour.
This is used by audio/zeya, http://web.psung.name/zeya/, which is
not active upstream. Server requirements: Python 2.5+ (2.6+
recommended), Latest release: 0.6  17 September 2011.

- Seems sensible to retire zeya and switch tagpy to py3-only.


vegastrike: currently py2 only. Redhat dropped it in 2019
(https://bugzilla.redhat.com/show_bug.cgi?id=1738149), the situation
changed since then and it's under development again (0.6.0 was released
recently), py3 support targetted for 0.7 devel / 0.8.0.

- Maybe mark broken for now?


openimageio: ports only uses this for Blender, the old version of this
in ports requires Py 3.7, so Blender can't be using the oiio Python bindings.
(this has a very active upstream, the port is overdue an update).

- This does build ok with MODPY_VERSION=${MODPY_DEFAULT_VERSION_3} so maybe
just do that?



Re: devel/boost: drop python2 support and speed up make fake

2020-11-11 Thread Brad Smith

On 11/11/2020 11:46 AM, Rafael Sadowski wrote:

On Wed Nov 11, 2020 at 05:02:08PM +0100, Jeremie Courreges-Anglas wrote:

On Mon, Nov 09 2020, Jeremie Courreges-Anglas  wrote:

On Sun, Nov 08 2020, Rafael Sadowski  wrote:

On Sun Nov 08, 2020 at 01:46:14AM +0100, Jeremie Courreges-Anglas wrote:

This diff drops boost_python27 and boost_numpy27.  I switched the
defaults to python3 but the boost-build .py files aren't ready for that
(using python3 -m compileall fails with syntax errors). No idea how
used/useful boost-build actually is or how maintainers want to deal with
this python2/3 mix.  One possible approach would be to run 2to3 on
those files, but this doesn't catch all the py2->py3 gotchas.

I also worked on it yesterday and found the same py2->py3 issue.

So what do you think should be done? :)

I can propose:
1. keep the diff as is, it looks weird but maybe boost-build still works fine
(no idea how to test that)
2. drop the boost-build parts until a new release brings proper python3
support
3. some hacks to make the current boost-build work with python3 (I have
nothing against it but I'd prefer not to care about this myself)

< rsadowski> My idea would be
[2] remove all in share/boost-build
[4] remove the compileall.py task.

I'd prefer to go with option 2, option 4 means that .pyc files can stay
around if the user starts boost-build as root.

So, shall we go ahead with this diff?  If so I'll ask Antoine to slip
this in his next bulk (per sthen@ suggestion).  More tests are obviously
welcome.

I have just committed the make fake tweak, so you need to apply this on
a fresh CVS checkout.


If Brad accept option 2, I would like to install the following tools
anyway. This means that the boost build system can still be used.


-   # boost-build:
-   ${INSTALL_PROGRAM} ${WRKSRC}/tools/build/src/engine/bin.*/{b2,bjam} \
-   ${PREFIX}/bin

...


-   ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/boost-build
-   ${INSTALL_DATA} ${WRKSRC}/tools/build/example/site-config.jam \
-   ${PREFIX}/share/examples/boost-build


Well the only question I have is if we remove this does anything in the 
ports tree
depend it for building anything? If not, then I'd say go with removing 
it all together
for the time being until it is updated to be compatible with Python 3. 
If the answer

is yes then how many ports?



Re: devel/boost: drop python2 support and speed up make fake

2020-11-11 Thread Rafael Sadowski
On Wed Nov 11, 2020 at 05:02:08PM +0100, Jeremie Courreges-Anglas wrote:
> On Mon, Nov 09 2020, Jeremie Courreges-Anglas  wrote:
> > On Sun, Nov 08 2020, Rafael Sadowski  wrote:
> >> On Sun Nov 08, 2020 at 01:46:14AM +0100, Jeremie Courreges-Anglas wrote:
> >>> 
> >>> This diff drops boost_python27 and boost_numpy27.  I switched the
> >>> defaults to python3 but the boost-build .py files aren't ready for that
> >>> (using python3 -m compileall fails with syntax errors). No idea how
> >>> used/useful boost-build actually is or how maintainers want to deal with
> >>> this python2/3 mix.  One possible approach would be to run 2to3 on
> >>> those files, but this doesn't catch all the py2->py3 gotchas.
> >>
> >> I also worked on it yesterday and found the same py2->py3 issue.
> >
> > So what do you think should be done? :)
> >
> > I can propose:
> > 1. keep the diff as is, it looks weird but maybe boost-build still works 
> > fine
> >(no idea how to test that)
> > 2. drop the boost-build parts until a new release brings proper python3
> >support
> > 3. some hacks to make the current boost-build work with python3 (I have
> >nothing against it but I'd prefer not to care about this myself)
> 
> < rsadowski> My idea would be
> [2] remove all in share/boost-build
> [4] remove the compileall.py task.
> 
> I'd prefer to go with option 2, option 4 means that .pyc files can stay
> around if the user starts boost-build as root.
> 
> So, shall we go ahead with this diff?  If so I'll ask Antoine to slip
> this in his next bulk (per sthen@ suggestion).  More tests are obviously
> welcome.
> 
> I have just committed the make fake tweak, so you need to apply this on
> a fresh CVS checkout.
> 

If Brad accept option 2, I would like to install the following tools
anyway. This means that the boost build system can still be used.

> 
> - # boost-build:
> - ${INSTALL_PROGRAM} ${WRKSRC}/tools/build/src/engine/bin.*/{b2,bjam} \
> - ${PREFIX}/bin

...

> - ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/boost-build
> - ${INSTALL_DATA} ${WRKSRC}/tools/build/example/site-config.jam \
> - ${PREFIX}/share/examples/boost-build



Re: devel/boost: drop python2 support and speed up make fake

2020-11-11 Thread Jeremie Courreges-Anglas
On Mon, Nov 09 2020, Jeremie Courreges-Anglas  wrote:
> On Sun, Nov 08 2020, Rafael Sadowski  wrote:
>> On Sun Nov 08, 2020 at 01:46:14AM +0100, Jeremie Courreges-Anglas wrote:
>>> 
>>> This diff drops boost_python27 and boost_numpy27.  I switched the
>>> defaults to python3 but the boost-build .py files aren't ready for that
>>> (using python3 -m compileall fails with syntax errors). No idea how
>>> used/useful boost-build actually is or how maintainers want to deal with
>>> this python2/3 mix.  One possible approach would be to run 2to3 on
>>> those files, but this doesn't catch all the py2->py3 gotchas.
>>
>> I also worked on it yesterday and found the same py2->py3 issue.
>
> So what do you think should be done? :)
>
> I can propose:
> 1. keep the diff as is, it looks weird but maybe boost-build still works fine
>(no idea how to test that)
> 2. drop the boost-build parts until a new release brings proper python3
>support
> 3. some hacks to make the current boost-build work with python3 (I have
>nothing against it but I'd prefer not to care about this myself)

< rsadowski> My idea would be
[2] remove all in share/boost-build
[4] remove the compileall.py task.

I'd prefer to go with option 2, option 4 means that .pyc files can stay
around if the user starts boost-build as root.

So, shall we go ahead with this diff?  If so I'll ask Antoine to slip
this in his next bulk (per sthen@ suggestion).  More tests are obviously
welcome.

I have just committed the make fake tweak, so you need to apply this on
a fresh CVS checkout.


Index: Makefile
===
RCS file: /cvs/ports/devel/boost/Makefile,v
retrieving revision 1.102
diff -u -p -r1.102 Makefile
--- Makefile11 Nov 2020 15:53:41 -  1.102
+++ Makefile11 Nov 2020 15:55:39 -
@@ -6,6 +6,7 @@ COMMENT-main=   free peer-reviewed portabl
 COMMENT-md=machine-dependent libraries for boost
 
 VERSION=   1.70.0
+REVISION=  0
 DISTNAME=  boost_${VERSION:S/./_/g}
 PKGNAME-main=  boost-${VERSION}
 PKGNAME-md=boost-md-${VERSION}
@@ -33,9 +34,7 @@ BOOST_LIBS=   boost_atomic-mt \
boost_math_tr1l-mt boost_math_tr1l \
boost_prg_exec_monitor-mt boost_prg_exec_monitor \
boost_program_options-mt boost_program_options \
-   boost_numpy27-mt boost_numpy27 \
boost_numpy38-mt boost_numpy38 \
-   boost_python27-mt boost_python27 \
boost_python38-mt boost_python38 \
boost_random-mt boost_random \
boost_regex-mt boost_regex \
@@ -79,12 +78,10 @@ COMPILER= base-clang ports-gcc
 MULTI_PACKAGES=-main -md
 
 MODULES=   lang/python
+MODPY_VERSION= ${MODPY_DEFAULT_VERSION_3}
 MODPY_RUNDEP=  No
 
-# extras needed until py2 support can be removed
-BUILD_DEPENDS+=math/py-numpy \
-   math/py-numpy,python3 \
-   lang/python/${MODPY_DEFAULT_VERSION_3}
+BUILD_DEPENDS= math/py-numpy${MODPY_FLAVOR}
 
 LIB_DEPENDS=   archivers/bzip2 \
textproc/icu4c
@@ -116,11 +113,11 @@ BJAM_CONFIG=  -sICU_PATH=${LOCALBASE} \
cxxflags='${CXXFLAGS} -pthread' \
variant=release \
link=static,shared \
-   threading=single,multi \
+   threading=single,multi
 
 BOOTSTRAP= --with-bjam=${WRKSRC}/bjam \
--with-toolset=${TOOLSET} \
-   --with-python-root=${LOCALBASE}
+   --with-python=${MODPY_BIN}
 
 # 'context' and 'coroutine' use MD bits and miss support for Alpha,
 # PA-RISC, SPARC and SuperH. The author does not care
@@ -129,18 +126,6 @@ BOOTSTRAP= --with-bjam=${WRKSRC}/bjam \
 BOOTSTRAP+=--without-libraries=context,coroutine,fiber,stacktrace
 .endif
 
-PY2_BOOTSTRAP= --with-python=${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_2} 
\
-   --with-python-version=${MODPY_DEFAULT_VERSION_2} \
-
-PY3_BOOTSTRAP= --with-python=${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_3} 
\
-   --with-python-version=${MODPY_DEFAULT_VERSION_3} \
-
-PY2_INC=   ${LOCALBASE}/include/python${MODPY_DEFAULT_VERSION_2}
-PY3_INC=   ${LOCALBASE}/include/python${MODPY_DEFAULT_VERSION_3}
-
-# temporary dir to stash libs when rebuilding with py2
-PY3_DIR=   ${WRKDIR}/lib.py3
-
 # python.port.mk makes assumptions about an empty CONFIGURE_STYLE
 CONFIGURE_STYLE= none
 
@@ -164,51 +149,18 @@ do-configure:
cd ${WRKSRC}/tools/build/src/engine && \
${SETENV} CC="${CC}" CFLAGS="${CFLAGS}" /bin/sh ./build.sh cc 
&& \
cp bin.openbsd*/b2 bin.openbsd*/bjam ${WRKSRC}
+   cd ${WRKSRC} && ${SETENV} /bin/sh ./bootstrap.sh ${BOOTSTRAP}
 
-# b2 doesn't seem to respect python parameter, we need to run twice with
-# separate python environments. when we remove py2 support later, bootstrap
-# can move back to the configure stage and avoid the build/rm/rebuild dance..
 

Re: devel/boost: drop python2 support and speed up make fake

2020-11-08 Thread Jeremie Courreges-Anglas
On Sun, Nov 08 2020, Rafael Sadowski  wrote:
> On Sun Nov 08, 2020 at 01:46:14AM +0100, Jeremie Courreges-Anglas wrote:
>> 
>> This diff drops boost_python27 and boost_numpy27.  I switched the
>> defaults to python3 but the boost-build .py files aren't ready for that
>> (using python3 -m compileall fails with syntax errors). No idea how
>> used/useful boost-build actually is or how maintainers want to deal with
>> this python2/3 mix.  One possible approach would be to run 2to3 on
>> those files, but this doesn't catch all the py2->py3 gotchas.
>
> I also worked on it yesterday and found the same py2->py3 issue.

So what do you think should be done? :)

I can propose:
1. keep the diff as is, it looks weird but maybe boost-build still works fine
   (no idea how to test that)
2. drop the boost-build parts until a new release brings proper python3
   support
3. some hacks to make the current boost-build work with python3 (I have
   nothing against it but I'd prefer not to care about this myself)

Or... maybe your ok below was about the whole diff (thus option 1) and
not just the make fake speedup?

>> Feedback welcome.
>> 
>> Unrelated, the do-install part has bugged me since some time.  It
>> copies ~15000 headers, forking one install(1) process per header file.
>> This is expensive, on my builder the diff below moves make fake from
>> ~4mn to ~4sec.  I'd like to commit this seperately.  oks?
>
> Nice work! Yes please! OK rsadowski@

[...]

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: devel/boost: drop python2 support and speed up make fake

2020-11-07 Thread Rafael Sadowski
On Sun Nov 08, 2020 at 01:46:14AM +0100, Jeremie Courreges-Anglas wrote:
> 
> This diff drops boost_python27 and boost_numpy27.  I switched the
> defaults to python3 but the boost-build .py files aren't ready for that
> (using python3 -m compileall fails with syntax errors). No idea how
> used/useful boost-build actually is or how maintainers want to deal with
> this python2/3 mix.  One possible approach would be to run 2to3 on
> those files, but this doesn't catch all the py2->py3 gotchas.

I also worked on it yesterday and found the same py2->py3 issue.

> 
> Feedback welcome.
> 
> Unrelated, the do-install part has bugged me since some time.  It
> copies ~15000 headers, forking one install(1) process per header file.
> This is expensive, on my builder the diff below moves make fake from
> ~4mn to ~4sec.  I'd like to commit this seperately.  oks?

Nice work! Yes please! OK rsadowski@


> 
> 
> Index: Makefile
> ===
> RCS file: /cvs/ports/devel/boost/Makefile,v
> retrieving revision 1.101
> diff -u -p -r1.101 Makefile
> --- Makefile  5 Nov 2020 11:23:03 -   1.101
> +++ Makefile  8 Nov 2020 00:17:38 -
> @@ -6,6 +6,7 @@ COMMENT-main= free peer-reviewed portabl
>  COMMENT-md=  machine-dependent libraries for boost
>  
>  VERSION= 1.70.0
> +REVISION=0
>  DISTNAME=boost_${VERSION:S/./_/g}
>  PKGNAME-main=boost-${VERSION}
>  PKGNAME-md=  boost-md-${VERSION}
> @@ -33,9 +34,7 @@ BOOST_LIBS= boost_atomic-mt \
>   boost_math_tr1l-mt boost_math_tr1l \
>   boost_prg_exec_monitor-mt boost_prg_exec_monitor \
>   boost_program_options-mt boost_program_options \
> - boost_numpy27-mt boost_numpy27 \
>   boost_numpy38-mt boost_numpy38 \
> - boost_python27-mt boost_python27 \
>   boost_python38-mt boost_python38 \
>   boost_random-mt boost_random \
>   boost_regex-mt boost_regex \
> @@ -79,12 +78,12 @@ COMPILER= base-clang ports-gcc
>  MULTI_PACKAGES=  -main -md
>  
>  MODULES= lang/python
> +MODPY_VERSION=   ${MODPY_DEFAULT_VERSION_3}
>  MODPY_RUNDEP=No
>  
> -# extras needed until py2 support can be removed
> -BUILD_DEPENDS+=  math/py-numpy \
> - math/py-numpy,python3 \
> - lang/python/${MODPY_DEFAULT_VERSION_3}
> +BUILD_DEPENDS+=  math/py-numpy${MODPY_FLAVOR}
> +# needed for byte-compiling boost-build
> +BUILD_DEPENDS+=  lang/python/${MODPY_DEFAULT_VERSION_2}
>  
>  LIB_DEPENDS= archivers/bzip2 \
>   textproc/icu4c
> @@ -116,11 +115,11 @@ BJAM_CONFIG=-sICU_PATH=${LOCALBASE} \
>   cxxflags='${CXXFLAGS} -pthread' \
>   variant=release \
>   link=static,shared \
> - threading=single,multi \
> + threading=single,multi
>  
>  BOOTSTRAP=   --with-bjam=${WRKSRC}/bjam \
>   --with-toolset=${TOOLSET} \
> - --with-python-root=${LOCALBASE}
> + --with-python=${MODPY_BIN}
>  
>  # 'context' and 'coroutine' use MD bits and miss support for Alpha,
>  # PA-RISC, SPARC and SuperH. The author does not care
> @@ -129,18 +128,6 @@ BOOTSTRAP=   --with-bjam=${WRKSRC}/bjam \
>  BOOTSTRAP+=  --without-libraries=context,coroutine,fiber,stacktrace
>  .endif
>  
> -PY2_BOOTSTRAP=   
> --with-python=${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_2} \
> - --with-python-version=${MODPY_DEFAULT_VERSION_2} \
> -
> -PY3_BOOTSTRAP=   
> --with-python=${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_3} \
> - --with-python-version=${MODPY_DEFAULT_VERSION_3} \
> -
> -PY2_INC= ${LOCALBASE}/include/python${MODPY_DEFAULT_VERSION_2}
> -PY3_INC= ${LOCALBASE}/include/python${MODPY_DEFAULT_VERSION_3}
> -
> -# temporary dir to stash libs when rebuilding with py2
> -PY3_DIR= ${WRKDIR}/lib.py3
> -
>  # python.port.mk makes assumptions about an empty CONFIGURE_STYLE
>  CONFIGURE_STYLE= none
>  
> @@ -164,39 +151,20 @@ do-configure:
>   cd ${WRKSRC}/tools/build/src/engine && \
>   ${SETENV} CC="${CC}" CFLAGS="${CFLAGS}" /bin/sh ./build.sh cc 
> && \
>   cp bin.openbsd*/b2 bin.openbsd*/bjam ${WRKSRC}
> + cd ${WRKSRC} && ${SETENV} /bin/sh ./bootstrap.sh ${BOOTSTRAP}
>  
> -# b2 doesn't seem to respect python parameter, we need to run twice with
> -# separate python environments. when we remove py2 support later, bootstrap
> -# can move back to the configure stage and avoid the build/rm/rebuild dance..
>  do-build:
> - # First run of bootstrap/b2, setup for py3 environment:
> - sed 's;\(using python.*PYTHON_ROOT\).*;\1 : ${PY3_INC} \;;' \
> - < ${WRKSRC}/bootstrap.sh > ${WRKSRC}/bootstrap.sh.tmp
> - cd ${WRKSRC} && export ${MAKE_ENV} && \
> - /bin/sh ./bootstrap.sh.tmp ${BOOTSTRAP} ${PY3_BOOTSTRAP} && \
> - ./b2 ${BJAM_CONFIG} --with-python 
> python=${MODPY_DEFAULT_VERSION_3}
> -   

Re: devel/boost: drop python2 support and speed up make fake

2020-11-07 Thread Brad Smith

On 11/7/2020 7:46 PM, Jeremie Courreges-Anglas wrote:

This diff drops boost_python27 and boost_numpy27.  I switched the
defaults to python3 but the boost-build .py files aren't ready for that
(using python3 -m compileall fails with syntax errors). No idea how
used/useful boost-build actually is or how maintainers want to deal with
this python2/3 mix.  One possible approach would be to run 2to3 on
those files, but this doesn't catch all the py2->py3 gotchas.


I like seeing numpy being removed. Can't comment on the rest as I don't do
much Python wise. This looks like it just might help me going forward with
Boost.


Feedback welcome.

Unrelated, the do-install part has bugged me since some time.  It
copies ~15000 headers, forking one install(1) process per header file.
This is expensive, on my builder the diff below moves make fake from
~4mn to ~4sec.  I'd like to commit this seperately.  oks?


The install target has always bugged me as it is. Any improvement is a win.



Index: Makefile
===
RCS file: /cvs/ports/devel/boost/Makefile,v
retrieving revision 1.101
diff -u -p -r1.101 Makefile
--- Makefile5 Nov 2020 11:23:03 -   1.101
+++ Makefile8 Nov 2020 00:17:38 -
@@ -6,6 +6,7 @@ COMMENT-main=   free peer-reviewed portabl
  COMMENT-md=   machine-dependent libraries for boost
  
  VERSION=	1.70.0

+REVISION=  0
  DISTNAME= boost_${VERSION:S/./_/g}
  PKGNAME-main= boost-${VERSION}
  PKGNAME-md=   boost-md-${VERSION}
@@ -33,9 +34,7 @@ BOOST_LIBS=   boost_atomic-mt \
boost_math_tr1l-mt boost_math_tr1l \
boost_prg_exec_monitor-mt boost_prg_exec_monitor \
boost_program_options-mt boost_program_options \
-   boost_numpy27-mt boost_numpy27 \
boost_numpy38-mt boost_numpy38 \
-   boost_python27-mt boost_python27 \
boost_python38-mt boost_python38 \
boost_random-mt boost_random \
boost_regex-mt boost_regex \
@@ -79,12 +78,12 @@ COMPILER= base-clang ports-gcc
  MULTI_PACKAGES=   -main -md
  
  MODULES=	lang/python

+MODPY_VERSION= ${MODPY_DEFAULT_VERSION_3}
  MODPY_RUNDEP= No
  
-# extras needed until py2 support can be removed

-BUILD_DEPENDS+=math/py-numpy \
-   math/py-numpy,python3 \
-   lang/python/${MODPY_DEFAULT_VERSION_3}
+BUILD_DEPENDS+=math/py-numpy${MODPY_FLAVOR}
+# needed for byte-compiling boost-build
+BUILD_DEPENDS+=lang/python/${MODPY_DEFAULT_VERSION_2}
  
  LIB_DEPENDS=	archivers/bzip2 \

textproc/icu4c
@@ -116,11 +115,11 @@ BJAM_CONFIG=  -sICU_PATH=${LOCALBASE} \
cxxflags='${CXXFLAGS} -pthread' \
variant=release \
link=static,shared \
-   threading=single,multi \
+   threading=single,multi
  
  BOOTSTRAP=	--with-bjam=${WRKSRC}/bjam \

--with-toolset=${TOOLSET} \
-   --with-python-root=${LOCALBASE}
+   --with-python=${MODPY_BIN}
  
  # 'context' and 'coroutine' use MD bits and miss support for Alpha,

  # PA-RISC, SPARC and SuperH. The author does not care
@@ -129,18 +128,6 @@ BOOTSTRAP= --with-bjam=${WRKSRC}/bjam \
  BOOTSTRAP+=   --without-libraries=context,coroutine,fiber,stacktrace
  .endif
  
-PY2_BOOTSTRAP=	--with-python=${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_2} \

-   --with-python-version=${MODPY_DEFAULT_VERSION_2} \
-
-PY3_BOOTSTRAP= --with-python=${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_3} 
\
-   --with-python-version=${MODPY_DEFAULT_VERSION_3} \
-
-PY2_INC=   ${LOCALBASE}/include/python${MODPY_DEFAULT_VERSION_2}
-PY3_INC=   ${LOCALBASE}/include/python${MODPY_DEFAULT_VERSION_3}
-
-# temporary dir to stash libs when rebuilding with py2
-PY3_DIR=   ${WRKDIR}/lib.py3
-
  # python.port.mk makes assumptions about an empty CONFIGURE_STYLE
  CONFIGURE_STYLE= none
  
@@ -164,39 +151,20 @@ do-configure:

cd ${WRKSRC}/tools/build/src/engine && \
${SETENV} CC="${CC}" CFLAGS="${CFLAGS}" /bin/sh ./build.sh cc 
&& \
cp bin.openbsd*/b2 bin.openbsd*/bjam ${WRKSRC}
+   cd ${WRKSRC} && ${SETENV} /bin/sh ./bootstrap.sh ${BOOTSTRAP}
  
-# b2 doesn't seem to respect python parameter, we need to run twice with

-# separate python environments. when we remove py2 support later, bootstrap
-# can move back to the configure stage and avoid the build/rm/rebuild dance..
  do-build:
-   # First run of bootstrap/b2, setup for py3 environment:
-   sed 's;\(using python.*PYTHON_ROOT\).*;\1 : ${PY3_INC} \;;' \
-   < ${WRKSRC}/bootstrap.sh > ${WRKSRC}/bootstrap.sh.tmp
-   cd ${WRKSRC} && export ${MAKE_ENV} && \
-   /bin/sh ./bootstrap.sh.tmp ${BOOTSTRAP} ${PY3_BOOTSTRAP} && \
-   ./b2 ${BJAM_CONFIG} --with-python 
python=${MODPY_DEFAULT_VERSION_3}
-   # Stash py3 libs in 

devel/boost: drop python2 support and speed up make fake

2020-11-07 Thread Jeremie Courreges-Anglas


This diff drops boost_python27 and boost_numpy27.  I switched the
defaults to python3 but the boost-build .py files aren't ready for that
(using python3 -m compileall fails with syntax errors). No idea how
used/useful boost-build actually is or how maintainers want to deal with
this python2/3 mix.  One possible approach would be to run 2to3 on
those files, but this doesn't catch all the py2->py3 gotchas.

Feedback welcome.

Unrelated, the do-install part has bugged me since some time.  It
copies ~15000 headers, forking one install(1) process per header file.
This is expensive, on my builder the diff below moves make fake from
~4mn to ~4sec.  I'd like to commit this seperately.  oks?


Index: Makefile
===
RCS file: /cvs/ports/devel/boost/Makefile,v
retrieving revision 1.101
diff -u -p -r1.101 Makefile
--- Makefile5 Nov 2020 11:23:03 -   1.101
+++ Makefile8 Nov 2020 00:17:38 -
@@ -6,6 +6,7 @@ COMMENT-main=   free peer-reviewed portabl
 COMMENT-md=machine-dependent libraries for boost
 
 VERSION=   1.70.0
+REVISION=  0
 DISTNAME=  boost_${VERSION:S/./_/g}
 PKGNAME-main=  boost-${VERSION}
 PKGNAME-md=boost-md-${VERSION}
@@ -33,9 +34,7 @@ BOOST_LIBS=   boost_atomic-mt \
boost_math_tr1l-mt boost_math_tr1l \
boost_prg_exec_monitor-mt boost_prg_exec_monitor \
boost_program_options-mt boost_program_options \
-   boost_numpy27-mt boost_numpy27 \
boost_numpy38-mt boost_numpy38 \
-   boost_python27-mt boost_python27 \
boost_python38-mt boost_python38 \
boost_random-mt boost_random \
boost_regex-mt boost_regex \
@@ -79,12 +78,12 @@ COMPILER= base-clang ports-gcc
 MULTI_PACKAGES=-main -md
 
 MODULES=   lang/python
+MODPY_VERSION= ${MODPY_DEFAULT_VERSION_3}
 MODPY_RUNDEP=  No
 
-# extras needed until py2 support can be removed
-BUILD_DEPENDS+=math/py-numpy \
-   math/py-numpy,python3 \
-   lang/python/${MODPY_DEFAULT_VERSION_3}
+BUILD_DEPENDS+=math/py-numpy${MODPY_FLAVOR}
+# needed for byte-compiling boost-build
+BUILD_DEPENDS+=lang/python/${MODPY_DEFAULT_VERSION_2}
 
 LIB_DEPENDS=   archivers/bzip2 \
textproc/icu4c
@@ -116,11 +115,11 @@ BJAM_CONFIG=  -sICU_PATH=${LOCALBASE} \
cxxflags='${CXXFLAGS} -pthread' \
variant=release \
link=static,shared \
-   threading=single,multi \
+   threading=single,multi
 
 BOOTSTRAP= --with-bjam=${WRKSRC}/bjam \
--with-toolset=${TOOLSET} \
-   --with-python-root=${LOCALBASE}
+   --with-python=${MODPY_BIN}
 
 # 'context' and 'coroutine' use MD bits and miss support for Alpha,
 # PA-RISC, SPARC and SuperH. The author does not care
@@ -129,18 +128,6 @@ BOOTSTRAP= --with-bjam=${WRKSRC}/bjam \
 BOOTSTRAP+=--without-libraries=context,coroutine,fiber,stacktrace
 .endif
 
-PY2_BOOTSTRAP= --with-python=${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_2} 
\
-   --with-python-version=${MODPY_DEFAULT_VERSION_2} \
-
-PY3_BOOTSTRAP= --with-python=${LOCALBASE}/bin/python${MODPY_DEFAULT_VERSION_3} 
\
-   --with-python-version=${MODPY_DEFAULT_VERSION_3} \
-
-PY2_INC=   ${LOCALBASE}/include/python${MODPY_DEFAULT_VERSION_2}
-PY3_INC=   ${LOCALBASE}/include/python${MODPY_DEFAULT_VERSION_3}
-
-# temporary dir to stash libs when rebuilding with py2
-PY3_DIR=   ${WRKDIR}/lib.py3
-
 # python.port.mk makes assumptions about an empty CONFIGURE_STYLE
 CONFIGURE_STYLE= none
 
@@ -164,39 +151,20 @@ do-configure:
cd ${WRKSRC}/tools/build/src/engine && \
${SETENV} CC="${CC}" CFLAGS="${CFLAGS}" /bin/sh ./build.sh cc 
&& \
cp bin.openbsd*/b2 bin.openbsd*/bjam ${WRKSRC}
+   cd ${WRKSRC} && ${SETENV} /bin/sh ./bootstrap.sh ${BOOTSTRAP}
 
-# b2 doesn't seem to respect python parameter, we need to run twice with
-# separate python environments. when we remove py2 support later, bootstrap
-# can move back to the configure stage and avoid the build/rm/rebuild dance..
 do-build:
-   # First run of bootstrap/b2, setup for py3 environment:
-   sed 's;\(using python.*PYTHON_ROOT\).*;\1 : ${PY3_INC} \;;' \
-   < ${WRKSRC}/bootstrap.sh > ${WRKSRC}/bootstrap.sh.tmp
-   cd ${WRKSRC} && export ${MAKE_ENV} && \
-   /bin/sh ./bootstrap.sh.tmp ${BOOTSTRAP} ${PY3_BOOTSTRAP} && \
-   ./b2 ${BJAM_CONFIG} --with-python 
python=${MODPY_DEFAULT_VERSION_3}
-   # Stash py3 libs in temporary dir:
-   mkdir ${PY3_DIR}
-   mv ${WRKSRC}/stage/lib/lib*python3* ${PY3_DIR}
-   mv ${WRKSRC}/stage/lib/lib*numpy3* ${PY3_DIR}
-   # Remove py3 .o files to force python recompilation:
-   rm ${WRKSRC}/project-config.jam
-   find ${WRKSRC}/bin.v2/libs/python -name "*.o"