Skip to content

Commit

Permalink
update build scripts: PEP 632 – Deprecate distutils module
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikaël BRIDAY committed Jan 31, 2024
1 parent 79ab986 commit c89f2a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions goil/templates/build/build_py.goilTemplate
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if exists POSTBUILD then
let postgoals := mapof exists POSTBUILD default ( @() ) by NAME
end if

%#! /usr/bin/env python
%#! /usr/bin/env python3
# -*- coding: UTF-8 -*-
#----------------------------------------------------------------------
#--- Python Build file for application % !CPUNAME %
Expand All @@ -61,7 +61,7 @@ end if
#--- build.py is generated each time goil is called by make.py
#----------------------------------------------------------------------

import sys, os, subprocess, string, distutils.spawn
import sys, os, subprocess, string
from string import Template

#--- Add some function for Python3 support
Expand Down
12 changes: 6 additions & 6 deletions goil/templates/build/make_py.goilTemplate
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ foreach pb in exists POSTBUILD default( @() ) do
end foreach
end foreach

%#! /usr/bin/env python
%#! /usr/bin/env python3
# -*- coding: UTF-8 -*-
#----------------------------------------------------------------------
#--- Python Make file for application % !CPUNAME %
Expand Down Expand Up @@ -179,11 +179,11 @@ os.chdir (scriptDir)

#--- Launch build.py
# is there the 'python' executable?
import distutils.spawn
if distutils.spawn.find_executable("python"):
childProcess = subprocess.Popen (["python", "build.py", askedGoal, str(maxParallelJobs)])
else: #no python executable, maybe python3
childProcess = subprocess.Popen (["python3", "build.py", askedGoal, str(maxParallelJobs)])
import shutil
cmd = shutil.which('python')
if not cmd:
cmd = shutil.which('python3')
childProcess = subprocess.Popen ([cmd, "build.py", askedGoal, str(maxParallelJobs)])

#--- Wait for subprocess termination
if childProcess.poll () == None :
Expand Down

0 comments on commit c89f2a8

Please sign in to comment.