def load_project(self, directory_path): """Load a project from the given directory. If there's a problem, the returned Project instance will have a non-empty ``problems`` attribute. So check ``project.problems`` when you get the result. ``project.problems`` can change anytime changes are made to a project; code must always be ready for a project to have some problems. Args: directory_path (str): path to the project directory Returns: a Project instance """ return project.Project(directory_path=directory_path)
def upload_project(project_path, args, username): try: from anaconda_project import project_ops except ImportError: raise errors.BinstarError("To upload projects such as {}, install the anaconda-project package.".format(project_path)) from anaconda_project import project if os.path.exists(project_path) and not os.path.isdir(project_path): # make the single file into a temporary project directory with (_TmpDir(prefix="anaconda_upload_")) as dirname: shutil.copy(project_path, dirname) basename_no_extension = os.path.splitext(os.path.basename(project_path))[0] project = project_ops.create(dirname, name=basename_no_extension) return _real_upload_project(project, args, username) else: project = project.Project(directory_path=project_path) return _real_upload_project(project, args, username)