Skip to content

Commit

Permalink
Expand unexpanded globs earlier than before
Browse files Browse the repository at this point in the history
If we receive a glob that was unexpanded, we already expand that.
However, we were not then updating our signatures dictionary and as
such we were probably uploading packages and signatures incorrectly in
that very rare case.

This changes twine-upload to expand those globs much earlier in the
execution so we do not miss any signature data or anything else while
uploading a package.

Related to pypa#132
  • Loading branch information
sigmavirus24 committed Sep 28, 2015
1 parent 40ce304 commit 174c809
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion tests/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def test_find_dists_handles_real_files():

def test_get_config_old_format(tmpdir):
pypirc = os.path.join(str(tmpdir), ".pypirc")
dists = ["tests/fixtures/twine-1.5.0-py2.py3-none-any.whl"]

with open(pypirc, "w") as fp:
fp.write(textwrap.dedent("""
Expand All @@ -75,7 +76,7 @@ def test_get_config_old_format(tmpdir):
"""))

try:
upload.upload(dists="foo", repository="pypi", sign=None, identity=None,
upload.upload(dists=dists, repository="pypi", sign=None, identity=None,
username=None, password=None, comment=None,
sign_with=None, config_file=pypirc, skip_existing=False)
except KeyError as err:
Expand Down
6 changes: 3 additions & 3 deletions twine/commands/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ def upload(dists, repository, sign, identity, username, password, comment,
if not sign and identity:
raise ValueError("sign must be given along with identity")

dists = find_dists(dists)

# Determine if the user has passed in pre-signed distributions
signatures = dict(
(os.path.basename(d), d) for d in dists if d.endswith(".asc")
)
dists = [i for i in dists if not i.endswith(".asc")]
uploads = [i for i in dists if not i.endswith(".asc")]

config = utils.get_repository_from_config(config_file, repository)

Expand All @@ -86,8 +88,6 @@ def upload(dists, repository, sign, identity, username, password, comment,

repository = Repository(config["repository"], username, password)

uploads = find_dists(dists)

for filename in uploads:
package = PackageFile.from_filename(filename, comment)

Expand Down

0 comments on commit 174c809

Please sign in to comment.