move __init__ to be the first func
@@ -41,6 +41,24 @@ class LocalPackage(object):
class Workspace(object):
default_filename = "conanws.yml"
+ def __init__(self, path, cache):
+ self._cache = cache
+ self._ws_generator = None
+ self._workspace_packages = OrderedDict() # {reference: LocalPackage}
+
+ if not os.path.isfile(path):
+ path = os.path.join(path, self.default_filename)
+
+ self._base_folder = os.path.dirname(path)
+ try:
+ content = load(path)
+ except IOError:
+ raise ConanException("Couldn't load workspace file in %s" % path)
+ try:
+ self._loads(content)
+ except Exception as e:
+ raise ConanException("There was an error parsing %s: %s" % (path, str(e)))
+
def generate(self, install_folder, graph, output):
if self._ws_generator == "cmake":
cmake = ""
@@ -87,24 +105,6 @@ class Workspace(object):
cmake_path = os.path.join(install_folder, "conanworkspace.cmake")
save(cmake_path, cmake)
- def __init__(self, path, cache):
- self._cache = cache
- self._ws_generator = None
- self._workspace_packages = OrderedDict() # {reference: LocalPackage}
-
- if not os.path.isfile(path):
- path = os.path.join(path, self.default_filename)
-
- self._base_folder = os.path.dirname(path)
- try:
- content = load(path)
- except IOError:
- raise ConanException("Couldn't load workspace file in %s" % path)
- try:
- self._loads(content)
- except Exception as e:
- raise ConanException("There was an error parsing %s: %s" % (path, str(e)))
-
def get_editable_dict(self):
return {ref: {"path": ws_package.root_folder, "layout": ws_package.layout}
for ref, ws_package in self._workspace_packages.items()}
