1
0
mirror of https://github.com/Rikj000/MoniGoMani.git synced 2022-03-06 00:08:05 +03:00

Added setup.exp for a more automated Freqtrade installation experience + BugFixed hidden folders not being copied

This commit is contained in:
Rik Helsen
2021-08-22 18:55:19 +02:00
parent 5350859524
commit 4bd2f663fd
2 changed files with 36 additions and 6 deletions

20
setup.exp Normal file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/expect -f
set force_conservative 0
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}
set timeout -1
spawn ./setup.sh --install
match_max 100000
expect "*Reset git branch? (This will remove all changes you made!)*" { send -- "n\r" }
expect "*Do you want to install dependencies for dev*" { send -- "y\r" }
expect "*Do you want to install plotting dependencies (plotly)*" { send -- "y\r" }
expect "*Do you want to install hyperopt dependencies*" { send -- "y\r" }
expect eof

View File

@@ -176,26 +176,36 @@ class FreqtradeCli:
return False
def copy_installation_files(self, temp_dirname: str, target_dir: str):
"""Copy the installation files to the target directory.
"""
Copy the installation files to the target directory. Also symlink the 'setup.exp' file.
:param temp_dirname: (str) The source directory where installation files exist.
:param target_dir: (str) The target directory where the installation files should be copied to.
"""
self.monigomani_cli.run_command('cp -R {0}/* {1}'.format(temp_dirname, target_dir))
if not os.path.exists(target_dir):
os.makedirs(target_dir, exist_ok=True)
self.monigomani_cli.run_command('cp -rT {0} {1}'.format(temp_dirname, target_dir))
if not os.path.isfile(f'{target_dir}/monigomani/setup.exp'):
self.cli_logger.error('🤷 No "setup.exp" found, back to the MoniGoMani installation docs it is!')
sys.exit(1)
os.symlink(f'{target_dir}/monigomani/setup.exp', f'{target_dir}/setup.exp')
def run_setup_installer(self, target_dir: str) -> bool:
"""
Run Freqtrade setup.sh --install.
Run Freqtrade setup.sh --install through setup.exp
:param target_dir: (str) The target directory where Freqtrade is installed.
:return bool: True if setup ran successfully. False otherwise.
"""
if os.path.isfile('{0}/setup.sh'.format(target_dir)):
self.monigomani_cli.run_command('bash {0}/setup.sh --install'.format(target_dir))
if os.path.isfile('{0}/setup.exp'.format(target_dir)):
# Using 'except' to automatically skip resetting the git repo, but do install all dependencies
self.monigomani_cli.run_command('{0}/setup.exp'.format(target_dir))
return True
self.cli_logger.error('Could not run {0}/setup.sh for Freqtrade because the file does not exist.'
self.cli_logger.error('Could not run {0}/setup.exp for Freqtrade because the file does not exist.'
.format(target_dir))
return False