fix: use python instead of python3 for script commands

this fixes building on windows, python 3 should be the default on all major os's
pull/3281/head
yougotwill 4 months ago
parent 8522605248
commit c3ff77fcb9

@ -41,8 +41,8 @@
"build-everything:watch": "yarn clean && yarn protobuf && yarn update-git-info && yarn sass && yarn build:locales-soft && yarn build:workers && yarn tsc -w", "build-everything:watch": "yarn clean && yarn protobuf && yarn update-git-info && yarn sass && yarn build:locales-soft && yarn build:workers && yarn tsc -w",
"start-dev:pretty": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod$MULTI electron . | npx bunyan", "start-dev:pretty": "cross-env NODE_ENV=production NODE_APP_INSTANCE=devprod$MULTI electron . | npx bunyan",
"build:workers": "yarn worker:utils && yarn worker:libsession", "build:workers": "yarn worker:utils && yarn worker:libsession",
"build:locales": "python3 ./tools/localization/generateLocales.py --generate-types --print-problems --error-on-problems --error-old-dynamic-variables", "build:locales": "python ./tools/localization/generateLocales.py --generate-types --print-problems --error-on-problems --error-old-dynamic-variables",
"build:locales-soft": "python3 ./tools/localization/generateLocales.py --generate-types --print-problems --print-problem-strings", "build:locales-soft": "python ./tools/localization/generateLocales.py --generate-types --print-problems --print-problem-strings",
"watch": "yarn clean && yarn protobuf && yarn update-git-info && yarn build-everything:watch", "watch": "yarn clean && yarn protobuf && yarn update-git-info && yarn build-everything:watch",
"protobuf": "pbjs --target static-module --wrap commonjs --out ts/protobuf/compiled.js protos/*.proto && pbts --out ts/protobuf/compiled.d.ts ts/protobuf/compiled.js --force-long", "protobuf": "pbjs --target static-module --wrap commonjs --out ts/protobuf/compiled.js protos/*.proto && pbts --out ts/protobuf/compiled.d.ts ts/protobuf/compiled.js --force-long",
"sass": "rimraf 'stylesheets/dist/' && webpack --config=./sass.config.js", "sass": "rimraf 'stylesheets/dist/' && webpack --config=./sass.config.js",
@ -61,7 +61,7 @@
"worker:libsession": "rimraf 'ts/webworker/workers/node/libsession/*.node' && webpack --config=./libsession.worker.config.js", "worker:libsession": "rimraf 'ts/webworker/workers/node/libsession/*.node' && webpack --config=./libsession.worker.config.js",
"dedup-yarn-lock": "npx --yes yarn-deduplicate yarn.lock", "dedup-yarn-lock": "npx --yes yarn-deduplicate yarn.lock",
"prepare": "husky install", "prepare": "husky install",
"print-deps": "node -v && python3 --version" "print-deps": "node -v && python --version"
}, },
"dependencies": { "dependencies": {
"@emoji-mart/data": "^1.1.2", "@emoji-mart/data": "^1.1.2",

@ -1,17 +1,21 @@
# Tools # Tools
> [!WARNING]
> Make sure you have the correct version of [Python](https://www.python.org/downloads/) installed.
> You can get the current `<version>` from the [`.tool-versions`](../.tool-versions).
## Using the Python scripts ## Using the Python scripts
The Python scripts are located in the `tools` directory. To run a script, use the following command: The Python scripts are located in the `tools` directory. To run a script, use the following command:
```bash ```bash
python3 ./tools/<script>.py python ./tools/<script>.py
``` ```
Most of these scripts can take arguments. To see the arguments for a script, use the following command: Most of these scripts can take arguments. To see the arguments for a script, use the following command:
```bash ```bash
python3 ./tools/<script>.py --help python ./tools/<script>.py --help
``` ```
## Utility ## Utility
@ -21,7 +25,7 @@ python3 ./tools/<script>.py --help
[./util/sortJson.py](./util/sortJson.py) sorts a given JSON file. [./util/sortJson.py](./util/sortJson.py) sorts a given JSON file.
```bash ```bash
python3 ./tools/util/sortJson.py <file> python ./tools/util/sortJson.py <file>
``` ```
## Localization ## Localization
@ -36,20 +40,20 @@ searches in the following directories:
- `./ts/` - `./ts/`
```bash ```bash
python3 ./tools/findString.py <token> python ./tools/findString.py <token>
``` ```
The script can automatically open the files in VSCode by passing the `--open` flag. The script can automatically open the files in VSCode by passing the `--open` flag.
```bash ```bash
python3 ./tools/findString.py <token> --open python ./tools/findString.py <token> --open
``` ```
> [!WARNING] > [!WARNING]
> The --open flag will open only the first result for the token in VSCode. If you wish to open more files, you can pass the `--limit` flag with the maximum number of files you wish to open. You can also pass the `--limit 0` flag to open all files containing the token. > The --open flag will open only the first result for the token in VSCode. If you wish to open more files, you can pass the `--limit` flag with the maximum number of files you wish to open. You can also pass the `--limit 0` flag to open all files containing the token.
```bash ```bash
python3 ./tools/findString.py <token> --open --limit 5 python ./tools/findString.py <token> --open --limit 5
``` ```
### [CrowdIn Post-Import](./localization/crowdInPostImport.sh) ### [CrowdIn Post-Import](./localization/crowdInPostImport.sh)
@ -78,14 +82,14 @@ are used but not known about. Without any input files this script outputs:
The script can be run with: The script can be run with:
```bash ```bash
python3 ./tools/localization/generateLocalizedStringsAnalysis.py python ./tools/localization/generateLocalizedStringsAnalysis.py
``` ```
> [!WARNING] > [!WARNING]
> If using macOS always run this script with the `--disable-concurrency` flag. > If using macOS always run this script with the `--disable-concurrency` flag.
```bash ```bash
python3 ./tools/localization/generateLocalizedStringsAnalysis.py --disable-concurrency python ./tools/localization/generateLocalizedStringsAnalysis.py --disable-concurrency
``` ```
The script can also take the following arguments: The script can also take the following arguments:

@ -5,4 +5,4 @@ echo 'Cleaning up CrowdIn import'
GENERATE_LOCALES_FILE=$PWD/tools/localization/generateLocales.py GENERATE_LOCALES_FILE=$PWD/tools/localization/generateLocales.py
# Generate Types and find problems if the python script exists with a non-zero exit code then the build will fail # Generate Types and find problems if the python script exists with a non-zero exit code then the build will fail
python3 $GENERATE_LOCALES_FILE --print-problems --error-on-problems --error-old-dynamic-variables --print-old-dynamic-variables python $GENERATE_LOCALES_FILE --print-problems --error-on-problems --error-old-dynamic-variables --print-old-dynamic-variables

Loading…
Cancel
Save