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): ...@@ -109,7 +109,7 @@ class Package(object):
self._platform = '*' self._platform = '*'
self._platform_constraint = EmptyConstraint() self._platform_constraint = EmptyConstraint()
self.cwd = None self.root_dir = None
@property @property
def name(self): def name(self):
...@@ -281,13 +281,13 @@ class Package(object): ...@@ -281,13 +281,13 @@ class Package(object):
dependency = FileDependency( dependency = FileDependency(
file_path, file_path,
category=category, category=category,
base=self.cwd base=self.root_dir
) )
elif 'path' in constraint: elif 'path' in constraint:
path = Path(constraint['path']) path = Path(constraint['path'])
if self.cwd: if self.root_dir:
is_file = (self.cwd / path).is_file() is_file = (self.root_dir / path).is_file()
else: else:
is_file = path.is_file() is_file = path.is_file()
...@@ -296,14 +296,14 @@ class Package(object): ...@@ -296,14 +296,14 @@ class Package(object):
path, path,
category=category, category=category,
optional=optional, optional=optional,
base=self.cwd base=self.root_dir
) )
else: else:
dependency = DirectoryDependency( dependency = DirectoryDependency(
path, path,
category=category, category=category,
optional=optional, optional=optional,
base=self.cwd, base=self.root_dir,
develop=constraint.get('develop', False) develop=constraint.get('develop', False)
) )
else: else:
......
...@@ -96,7 +96,7 @@ class Poetry: ...@@ -96,7 +96,7 @@ class Poetry:
name = local_config['name'] name = local_config['name']
version = local_config['version'] version = local_config['version']
package = Package(name, version, version) package = Package(name, version, version)
package.cwd = Path(cwd) package.root_dir = poetry_file.parent
for author in local_config['authors']: for author in local_config['authors']:
package.authors.append(author) package.authors.append(author)
...@@ -109,7 +109,7 @@ class Poetry: ...@@ -109,7 +109,7 @@ class Poetry:
package.classifiers = local_config.get('classifiers', []) package.classifiers = local_config.get('classifiers', [])
if 'readme' in local_config: 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: if 'platform' in local_config:
package.platform = local_config['platform'] 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