@@ -13,7 +13,8 @@ class pypi {
1313 exchangeConfigs :any ;
1414 pypiApiSecret :any ;
1515 rootDir :string = __dirname + `/../` ;
16-
16+ tempPyDir :string = this . rootDir + `/temp_pypi/` ;
17+
1718 constructor ( exchange : string , pypiApiSecret : string ) {
1819 this . exchange = exchange ;
1920 this . exchangeConfigs = jsonFromFile ( __dirname + `/global-configs.json` ) [ 'exchanges' ] ;
@@ -23,19 +24,18 @@ class pypi {
2324
2425 init ( exchange ) {
2526 // create skeleton dirs
26- const tmpDir = this . rootDir + `/temp_pypi/` ;
27- mkdir ( tmpDir ) ;
28- mkdir ( tmpDir + '/tests/' ) ; // just empty folder
27+ mkdir ( this . tempPyDir ) ;
28+ mkdir ( this . tempPyDir + '/tests/' ) ; // just empty folder
2929 // copy python folder to temp dir
3030 const pypiPackageName = this . exchangeConfigs [ exchange ] . __PYTHON_PACKAGE_NAME__ ;
3131 const pypiPackageNameSanitized = this . sanitizeFolderName ( pypiPackageName ) ;
32- const pkgDir = tmpDir + '/src/' + pypiPackageNameSanitized ;
32+ const pkgDir = this . tempPyDir + '/src/' + pypiPackageNameSanitized ;
3333 mkdir ( pkgDir ) ;
3434 cp ( this . rootDir + `/${ this . exchange } ` , pkgDir ) ;
3535 // copy readme
36- cp ( this . rootDir + `/README.md` , tmpDir + '/README.md' ) ;
36+ cp ( this . rootDir + `/README.md` , this . tempPyDir + '/README.md' ) ;
3737 // write pyproject.toml
38- fs . writeFileSync ( tmpDir + '/pyproject.toml' , this . pyprojectTolmContent ( pypiPackageNameSanitized ) ) ;
38+ fs . writeFileSync ( this . tempPyDir + '/pyproject.toml' , this . pyprojectTolmContent ( pypiPackageNameSanitized ) ) ;
3939 }
4040
4141 sanitizeFolderName ( name :string ) {
@@ -73,6 +73,17 @@ class pypi {
7373 ;
7474 return content ;
7575 }
76+
77+
78+ pythonBuild ( ) {
79+ execSync ( `cd ${ this . tempPyDir } && python -m build` ) ;
80+ execSync ( `cd ${ this . tempPyDir } && twine upload dist/*` , {
81+ env : {
82+ TWINE_USERNAME : '__token__' ,
83+ TWINE_PASSWORD : this . pypiApiSecret
84+ }
85+ } ) ;
86+ }
7687}
7788
7889// check if environment variabele exist
0 commit comments