コード例 #1
0
ファイル: updater.py プロジェクト: thelegend831/FarSeer-NMR
    def __init__(self,
                 install_wd,
                 update_log="update.log",
                 new_version_url=_new_version_url,
                 new_version_zip=_new_version_zip,
                 folders_to_remove=_folders_to_remove):
        """
        
        Parameters:
            - install_wd (str): the software installation directory
            
            - update_log (opt): the name of the log file (df: 'update.log')
            
            - new_version_url (opt): link to new version
                (df: https://github.com/<archive>/master.zip)
            
            - new_version_zip (opt): ZIP file to temporarily save new version
                (df: 'master.zip')
            
            - folders_to_remove (opt): list of folders to remove from
                old version.
            
        """

        self.log = logger.InstallLogger(__name__).gen_logger()
        self.log.debug("Initiated Updater instance")

        self.set_install_wd(install_wd)

        self.set_new_version_url(new_version_url)
        self.set_new_version_zip(os.path.join(install_wd, new_version_zip))
        self.set_folders_to_remove(folders_to_remove)
        self.set_zip_folder(None)

        return
コード例 #2
0
 def __init__(self, cwd=None, env=None):
     """
     Parameters:
         
         - cwd (opt, str): the Miniconda installation path.
             Defaults to os.get_cwd()
         
         - env (opt): a YML env file. If None provided, can't install
             environment.
     """
     
     self.log = logger.InstallLogger(__name__).gen_logger()
     
     cwd = cwd or os.get_cwd()
     self.set_install_folder(cwd)
     
     self.set_miniconda_base_web_link(system.base_miniconda_web_link)
     
     self.set_miniconda_web_file(
         "Miniconda3-latest-{}-{}.{}".format(
             system.platform,
             system.bits,
             system.miniconda_file_extension
             )
         )
     
     self.set_miniconda_download_link(
         urlparse.urljoin(
             self.get_miniconda_base_web_link(),
             self.get_miniconda_web_file()
             )
         )
     
     self.set_miniconda_install_file(
         os.path.join(
             self.get_install_folder(),
             self.get_miniconda_web_file()
             )
         )
     
     self.set_miniconda_install_folder(
         os.path.join(
             self.get_install_folder(),
             system.default_miniconda_folder
             )
         )
     
     self.set_env_file(env)
     
     return
コード例 #3
0
from install import host_project_vars
from install import system
from install import messages
# logging is required before importing the other package libs
from install import logger

# STARTS LOGGING
logfile_name = os.path.join(
    system.installation_folder,
    host_project_vars.installation_log_name
    )

if os.path.exists(logfile_name):
    os.remove(logfile_name)

log = logger.InstallLogger(__name__, log_file_name=logfile_name).gen_logger()

# CONFIRMS PYTHON VERSION
python_version = sys.version_info[0]
log.debug("* Python version: {}".format(python_version))

if python_version == 2:
    user_input = raw_input

elif python_version == 3:
    user_input = input

else:
    log.info(messages.unknown_python)
    log.info("* You are running Python version: {}".format(python_version))
    _name = host_project_vars.software_name
コード例 #4
0
You should have received a copy of the GNU General Public License
along with Farseer-NMR. If not, see <http://www.gnu.org/licenses/>.
"""
import sys
import os
import subprocess
import stat
import shutil
import ctypes

from install import logger
from install import system
from install import messages
from install import executables

log = logger.InstallLogger(__name__).gen_logger()

python_version = sys.version_info[0]
log.debug("* Python version: {}".format(python_version))

if python_version < 3:
    import urllib as url
    url_not_found_error = IOError
    user_input = raw_input

elif python_version == 3:
    import urllib
    import urllib.request as url
    url_not_found_error = urllib.error.URLError
    user_input = input