aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Vijay A <vraravam@users.noreply.github.com>2022-12-09 09:29:23 +0530
committerLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2022-12-09 11:45:47 +0530
commitcdbec08f5a967220ba0375dbc6e683134d73f95f (patch)
tree7c39e51ce0dedab30f0c77960331b6b4fccb438a
parentUpdate 'recipes' submodule (diff)
downloadferdium-server-cdbec08f5a967220ba0375dbc6e683134d73f95f.tar.gz
ferdium-server-cdbec08f5a967220ba0375dbc6e683134d73f95f.tar.zst
ferdium-server-cdbec08f5a967220ba0375dbc6e683134d73f95f.zip
Add 'python' dependency for compiling native libs
-rw-r--r--CONTRIBUTING.md7
-rw-r--r--package-lock.json4
-rw-r--r--package.json3
-rwxr-xr-xscripts/build-unix.sh2
-rw-r--r--scripts/build-windows.ps135
5 files changed, 38 insertions, 13 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index fdf4bd3..b887c86 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -13,7 +13,7 @@
13 - [How Can I Contribute?](#how-can-i-contribute) 13 - [How Can I Contribute?](#how-can-i-contribute)
14 - [Setting up your Development machine](#setting-up-your-development-machine) 14 - [Setting up your Development machine](#setting-up-your-development-machine)
15 - [Install System-level dependencies](#install-system-level-dependencies) 15 - [Install System-level dependencies](#install-system-level-dependencies)
16 - [Node.js, npm, pnpm](#nodejs-npm-pnpm) 16 - [Node.js, npm, pnpm, python](#nodejs-npm-pnpm-python)
17 - [Git](#git) 17 - [Git](#git)
18 - [Clone repository with submodule](#clone-repository-with-submodule) 18 - [Clone repository with submodule](#clone-repository-with-submodule)
19 - [Install dependencies](#install-dependencies) 19 - [Install dependencies](#install-dependencies)
@@ -40,7 +40,7 @@ As a basic rule, before filing issues, feature requests or anything else, please
40 40
41### Install System-level dependencies 41### Install System-level dependencies
42 42
43#### Node.js, npm, pnpm 43#### Node.js, npm, pnpm, python
44 44
45Please make sure you are conforming to the `engines` requirements used by the developers/contributors as specified in the [`package.json`](./package.json#engines) and [`recipes/package.json`](./recipes/package.json#engine) files. 45Please make sure you are conforming to the `engines` requirements used by the developers/contributors as specified in the [`package.json`](./package.json#engines) and [`recipes/package.json`](./recipes/package.json#engine) files.
46 46
@@ -51,7 +51,8 @@ $ jq --null-input '[inputs.engines] | add' < ./package.json < ./recipes/package.
51{ 51{
52 "node": "16.18.1", 52 "node": "16.18.1",
53 "npm": "8.19.2", 53 "npm": "8.19.2",
54 "pnpm": "7.18.1" 54 "pnpm": "7.18.1",
55 "python": "3.11.1"
55} 56}
56``` 57```
57 58
diff --git a/package-lock.json b/package-lock.json
index e230ff6..6247702 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -47,7 +47,9 @@
47 }, 47 },
48 "engines": { 48 "engines": {
49 "node": "16.18.1", 49 "node": "16.18.1",
50 "npm": "8.19.2" 50 "npm": "8.19.2",
51 "pnpm": "7.18.1",
52 "python": "3.11.1"
51 } 53 }
52 }, 54 },
53 "node_modules/@adonisjs/ace": { 55 "node_modules/@adonisjs/ace": {
diff --git a/package.json b/package.json
index f55d9d9..eab158b 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,8 @@
7 "engines": { 7 "engines": {
8 "node": "16.18.1", 8 "node": "16.18.1",
9 "npm": "8.19.2", 9 "npm": "8.19.2",
10 "pnpm": "7.18.1" 10 "pnpm": "7.18.1",
11 "python": "3.11.1"
11 }, 12 },
12 "scripts": { 13 "scripts": {
13 "prepare": "is-ci || husky install", 14 "prepare": "is-ci || husky install",
diff --git a/scripts/build-unix.sh b/scripts/build-unix.sh
index ff1ce0f..24ab0f7 100755
--- a/scripts/build-unix.sh
+++ b/scripts/build-unix.sh
@@ -75,7 +75,7 @@ fi
75# ----------------------------------------------------------------------------- 75# -----------------------------------------------------------------------------
76# Ensure that the system dependencies are at the correct version - fail if not 76# Ensure that the system dependencies are at the correct version - fail if not
77# Check python version 77# Check python version
78EXPECTED_PYTHON_VERSION="3.10.4" 78EXPECTED_PYTHON_VERSION=$(node -p 'require("./package.json").engines.python')
79ACTUAL_PYTHON_VERSION=$(python --version | sed -e "s/Python //") 79ACTUAL_PYTHON_VERSION=$(python --version | sed -e "s/Python //")
80if [[ "$ACTUAL_PYTHON_VERSION" != "$EXPECTED_PYTHON_VERSION" ]]; then 80if [[ "$ACTUAL_PYTHON_VERSION" != "$EXPECTED_PYTHON_VERSION" ]]; then
81 fail_with_docs "You are not running the expected version of Python! 81 fail_with_docs "You are not running the expected version of Python!
diff --git a/scripts/build-windows.ps1 b/scripts/build-windows.ps1
index 81187c6..4026aa5 100644
--- a/scripts/build-windows.ps1
+++ b/scripts/build-windows.ps1
@@ -93,7 +93,7 @@ if ($env:CLEAN -eq "true")
93# ----------------------------------------------------------------------------- 93# -----------------------------------------------------------------------------
94# Ensure that the system dependencies are at the correct version - fail if not 94# Ensure that the system dependencies are at the correct version - fail if not
95# Check python version 95# Check python version
96$EXPECTED_PYTHON_VERSION = "3.10.4" 96$EXPECTED_PYTHON_VERSION = (Get-Content package.json | ConvertFrom-Json).engines.python
97$ACTUAL_PYTHON_VERSION = (python --version).trim("Python ") 97$ACTUAL_PYTHON_VERSION = (python --version).trim("Python ")
98if ([System.Version]$ACTUAL_PYTHON_VERSION -ne [System.Version]$EXPECTED_PYTHON_VERSION) { 98if ([System.Version]$ACTUAL_PYTHON_VERSION -ne [System.Version]$EXPECTED_PYTHON_VERSION) {
99 fail_with_docs "You are not running the expected version of Python! 99 fail_with_docs "You are not running the expected version of Python!
@@ -101,14 +101,35 @@ if ([System.Version]$ACTUAL_PYTHON_VERSION -ne [System.Version]$EXPECTED_PYTHON_
101 actual : [$ACTUAL_PYTHON_VERSION]" 101 actual : [$ACTUAL_PYTHON_VERSION]"
102} 102}
103 103
104# TODO: Needs proper way to check MSVS Tools
105# Check MSVS Tools through MSVS_VERSION 104# Check MSVS Tools through MSVS_VERSION
106$EXPECTED_MSVST_VERSION = "2015" 105$EXPECTED_MSVST_VERSION = @("2019","2022")
107$ACTUAL_MSVST_VERSION = (npm config get msvs_version) 106$NPM_CONFIG_MSVS_VERSION = npm config get msvs_version
108if ([double]$ACTUAL_MSVST_VERSION -ne [double]$EXPECTED_MSVST_VERSION) { 107if((-not $NPM_CONFIG_MSVS_VERSION) -or -not ($EXPECTED_MSVST_VERSION -contains $NPM_CONFIG_MSVS_VERSION)){
109 fail_with_docs "You are not running the expected version of MSVS Tools! 108 Write-Host "Your Microsoft Visual Studio Tools isn't set properly or it's not the right version!
109 Checking your version..."
110
111 # TODO: Implement path for ARM machines
112 $MSVS_REG_PATH = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\X64"
113
114 if(-not (Test-Path -Path $MSVS_REG_PATH)){
115 fail_with_docs "You don't have the Microsoft Visual Studio Tools installed!"
116 }
117
118 $MSVS_VERSION = [int]((Get-ItemProperty -Path $MSVS_REG_PATH).Version.substring(4, 2))
119 switch($MSVS_VERSION) {
120 { $MSVS_VERSION -ge 30 } {$ACTUAL_MSVST_VERSION = "2022"}
121 { ($MSVS_VERSION -ge 20) -and ($MSVS_VERSION -le 29) } {$ACTUAL_MSVST_VERSION = "2019"}
122 { $MSVS_VERSION -lt 20 } {$ACTUAL_MSVST_VERSION = "2017 or lower"}
123 }
124
125 if (-not ($EXPECTED_MSVST_VERSION -contains $ACTUAL_MSVST_VERSION)) {
126 fail_with_docs "You are not running the expected version of MSVS Tools!
110 expected: [$EXPECTED_MSVST_VERSION] 127 expected: [$EXPECTED_MSVST_VERSION]
111 actual : [$ACTUAL_MSVST_VERSION]" 128 actual : [$ACTUAL_MSVST_VERSION]"
129 }
130
131 Write-Host "Changing your msvs_version on npm to [$ACTUAL_MSVST_VERSION]"
132 npm config set msvs_version $ACTUAL_MSVST_VERSION
112} 133}
113 134
114# ----------------------------------------------------------------------------- 135# -----------------------------------------------------------------------------
@@ -125,7 +146,7 @@ if ($EXPECTED_NPM_VERSION -ne $ACTUAL_NPM_VERSION) {
125} 146}
126 147
127# Check pnpm version 148# Check pnpm version
128$EXPECTED_PNPM_VERSION = (Get-Content recipes\package.json | ConvertFrom-Json).engines.pnpm 149$EXPECTED_PNPM_VERSION = (Get-Content .\recipes\package.json | ConvertFrom-Json).engines.pnpm
129$ACTUAL_PNPM_VERSION = Get-Command pnpm --version -ErrorAction SilentlyContinue # in case the pnpm executable itself is not present 150$ACTUAL_PNPM_VERSION = Get-Command pnpm --version -ErrorAction SilentlyContinue # in case the pnpm executable itself is not present
130if ($ACTUAL_PNPM_VERSION -ne $EXPECTED_PNPM_VERSION) { 151if ($ACTUAL_PNPM_VERSION -ne $EXPECTED_PNPM_VERSION) {
131 npm i -gf pnpm@$EXPECTED_PNPM_VERSION 152 npm i -gf pnpm@$EXPECTED_PNPM_VERSION