Commit 42173665 by Christopher Armstrong Committed by Sébastien Eustace

evaluate "path" dependencies as relative to the pyproject.toml, not to the CWD (#97)

* evaluate "path" dependencies as relative to the pyproject.toml, not to the CWD

* use the root dir for more things, not just path dependencies

get rid of cwd entirely from the Package class.
parent 87c4aaf9
......@@ -109,7 +109,7 @@ class Package(object):
self._platform = '*'
self._platform_constraint = EmptyConstraint()
self.cwd = None
self.root_dir = None
@property
def name(self):
......@@ -281,13 +281,13 @@ class Package(object):
dependency = FileDependency(
file_path,
category=category,
base=self.cwd
base=self.root_dir
)
elif 'path' in constraint:
path = Path(constraint['path'])
if self.cwd:
is_file = (self.cwd / path).is_file()
if self.root_dir:
is_file = (self.root_dir / path).is_file()
else:
is_file = path.is_file()
......@@ -296,14 +296,14 @@ class Package(object):
path,
category=category,
optional=optional,
base=self.cwd
base=self.root_dir
)
else:
dependency = DirectoryDependency(
path,
category=category,
optional=optional,
base=self.cwd,
base=self.root_dir,
develop=constraint.get('develop', False)
)
else:
......
......@@ -96,7 +96,7 @@ class Poetry:
name = local_config['name']
version = local_config['version']
package = Package(name, version, version)
package.cwd = Path(cwd)
package.root_dir = poetry_file.parent
for author in local_config['authors']:
package.authors.append(author)
......@@ -109,7 +109,7 @@ class Poetry:
package.classifiers = local_config.get('classifiers', [])
if 'readme' in local_config:
package.readme = Path(cwd) / local_config['readme']
package.readme = Path(poetry_file.parent) / local_config['readme']
if 'platform' in local_config:
package.platform = local_config['platform']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment