Skip to content

Commit

Permalink
feat: Add proper support for IBM i
Browse files Browse the repository at this point in the history
Python 3.9 on IBM i now properly returns "os400" for sys.platform
instead of claiming to be AIX as it did previously. While the IBM i PASE
environment is compatible with AIX, it is a subset and has numerous
differences which makes it beneficial to distinguish, however this means
that it now needs explicit support here.
  • Loading branch information
kadler authored and richardlau committed Sep 24, 2022
1 parent 3e2a532 commit a26494f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions addon.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@
'-Wl,-bimport:<(node_exp_file)'
],
}],
[ 'OS=="os400"', {
'ldflags': [
'-Wl,-bimport:<(node_exp_file)'
],
}],
[ 'OS=="zos"', {
'cflags': [
'-q64',
Expand Down
2 changes: 2 additions & 0 deletions lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ function build (gyp, argv, callback) {
var platformMake = 'make'
if (process.platform === 'aix') {
platformMake = 'gmake'
} else if (process.platform === 'os400') {
platformMake = 'gmake'
} else if (process.platform.indexOf('bsd') !== -1) {
platformMake = 'gmake'
} else if (win && argv.length > 0) {
Expand Down
8 changes: 4 additions & 4 deletions lib/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ function configure (gyp, argv, callback) {
// For AIX and z/OS we need to set up the path to the exports file
// which contains the symbols needed for linking.
var nodeExpFile
if (process.platform === 'aix' || process.platform === 'os390') {
var ext = process.platform === 'aix' ? 'exp' : 'x'
if (process.platform === 'aix' || process.platform === 'os390' || process.platform === 'os400') {
var ext = process.platform === 'os390' ? 'x' : 'exp'
var nodeRootDir = findNodeDirectory()
var candidates

if (process.platform === 'aix') {
if (process.platform === 'aix' || process.platform === 'os400') {
candidates = [
'include/node/node',
'out/Release/node',
Expand Down Expand Up @@ -276,7 +276,7 @@ function configure (gyp, argv, callback) {
argv.push('-Dlibrary=shared_library')
argv.push('-Dvisibility=default')
argv.push('-Dnode_root_dir=' + nodeDir)
if (process.platform === 'aix' || process.platform === 'os390') {
if (process.platform === 'aix' || process.platform === 'os390' || process.platform === 'os400') {
argv.push('-Dnode_exp_file=' + nodeExpFile)
if (process.platform === 'os390' && zoslibIncDir) {
argv.push('-Dzoslib_include_dir=' + zoslibIncDir)
Expand Down
2 changes: 1 addition & 1 deletion test/test-find-node-directory.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const test = require('tap').test
const path = require('path')
const findNodeDirectory = require('../lib/find-node-directory')

const platforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32', 'aix']
const platforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32', 'aix', 'os400']

// we should find the directory based on the directory
// the script is running in and it should match the layout
Expand Down

0 comments on commit a26494f

Please sign in to comment.