Skip to content

Commit 81e0c19

Browse files
committed
[build] 16
1 parent 76238b9 commit 81e0c19

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

build/pypi.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@ class pypi {
2828
mkdir (this.tempPyDir + '/tests/'); // just empty folder
2929
// copy python folder to temp dir
3030
const pypiPackageName = this.exchangeConfigs[exchange].__PYTHON_PACKAGE_NAME__;
31-
const pypiPackageNameSanitized = this.sanitizeFolderName(pypiPackageName);
31+
const pypiPackageNameSanitized = this.sanitizeFolderName (pypiPackageName);
3232
const pkgDir = this.tempPyDir + '/src/' + pypiPackageNameSanitized;
3333
mkdir (pkgDir);
34-
cp(this.rootDir + `/${this.exchange}`, pkgDir);
34+
cp (this.rootDir + `/${this.exchange}`, pkgDir);
3535
// copy readme
36-
cp(this.rootDir + `/README.md`, this.tempPyDir + '/README.md');
36+
cp (this.rootDir + `/README.md`, this.tempPyDir + '/README.md');
3737
// write pyproject.toml
3838
fs.writeFileSync(this.tempPyDir + '/pyproject.toml', this.pyprojectTolmContent(pypiPackageNameSanitized));
39+
this.pythonPackageBuild ();
40+
this.twinePublish ();
3941
}
4042

4143
sanitizeFolderName (name:string) {
@@ -75,17 +77,19 @@ class pypi {
7577
}
7678

7779

78-
pythonBuild () {
79-
const output1 = execSync(`cd ${this.tempPyDir} && python -m build`);
80-
console.log(output1.toString());
81-
82-
const output2 = execSync(`cd ${this.tempPyDir} && twine upload dist/*`, {
80+
pythonPackageBuild () {
81+
const res = execSync(`cd ${this.tempPyDir} && python -m build`);
82+
console.log(res.toString());
83+
}
84+
85+
twinePublish () {
86+
const res = execSync(`cd ${this.tempPyDir} && twine upload dist/*`, {
8387
env: {
8488
TWINE_USERNAME: '__token__',
8589
TWINE_PASSWORD: this.pypiApiSecret
8690
}
8791
});
88-
console.log(output2.toString());
92+
console.log(res.toString());
8993
}
9094
}
9195

0 commit comments

Comments
 (0)