diff --git a/mindspore/_version_check.py b/mindspore/_version_check.py index 3780f32c59f..cf4bd5d8362 100644 --- a/mindspore/_version_check.py +++ b/mindspore/_version_check.py @@ -20,7 +20,7 @@ from abc import abstractmethod, ABCMeta from packaging import version from . import log as logger from .version import __version__ -from .package_name import __package_name__ +from .default_config import __package_name__ class EnvChecker(metaclass=ABCMeta): diff --git a/mindspore/context.py b/mindspore/context.py index 22cee570e63..d057a2bdc25 100644 --- a/mindspore/context.py +++ b/mindspore/context.py @@ -27,8 +27,7 @@ from mindspore._checkparam import args_type_check from mindspore.parallel._auto_parallel_context import _set_auto_parallel_context, _get_auto_parallel_context, \ _reset_auto_parallel_context from mindspore.parallel._ps_context import _set_ps_context, _get_ps_context, _reset_ps_context -from .device_target import __device_target__ -from .package_name import __package_name__ +from .default_config import __device_target__, __package_name__ __all__ = ['GRAPH_MODE', 'PYNATIVE_MODE', 'set_context', 'get_context', 'set_auto_parallel_context', 'get_auto_parallel_context', 'reset_auto_parallel_context', 'ParallelMode', 'set_ps_context', diff --git a/setup.py b/setup.py index c746c54c3df..c27cf446ad8 100644 --- a/setup.py +++ b/setup.py @@ -65,22 +65,6 @@ def _write_device_target(file): def build_dependencies(): """generate python file""" - target = os.path.join(pkg_dir, 'mindspore', 'device_target.py') - with open(target, 'w') as f: - _write_device_target(f) - - target = os.path.join(pwd, 'mindspore', 'device_target.py') - with open(target, 'w') as f: - _write_device_target(f) - - package_info = os.path.join(pkg_dir, 'mindspore', 'package_name.py') - with open(package_info, 'w') as f: - _write_package_name(f) - - package_info = os.path.join(pwd, 'mindspore', 'package_name.py') - with open(package_info, 'w') as f: - _write_package_name(f) - version_file = os.path.join(pkg_dir, 'mindspore', 'version.py') with open(version_file, 'w') as f: _write_version(f) @@ -97,6 +81,22 @@ def build_dependencies(): with open(config_file, 'w') as f: _write_config(f) + target = os.path.join(pkg_dir, 'mindspore', 'default_config.py') + with open(target, 'a') as f: + _write_device_target(f) + + target = os.path.join(pwd, 'mindspore', 'default_config.py') + with open(target, 'a') as f: + _write_device_target(f) + + package_info = os.path.join(pkg_dir, 'mindspore', 'default_config.py') + with open(package_info, 'a') as f: + _write_package_name(f) + + package_info = os.path.join(pwd, 'mindspore', 'default_config.py') + with open(package_info, 'a') as f: + _write_package_name(f) + commit_file = os.path.join(pkg_dir, 'mindspore', '.commit_id') with open(commit_file, 'w') as f: _write_commit_file(f)