New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace tar command with something that works #552

Merged
merged 2 commits into from Sep 17, 2018

Conversation

Projects
None yet
4 participants
@jwodder
Copy link
Contributor

jwodder commented Sep 15, 2018

In the "Dropping support for older Python versions" guide, the tar command given for showing the sdist's metadata does not work (unless you happen to run it in your project directory without cleaning up your .egg-info dir first, in which case it only works by accident and the tar is pointless). This pull request changes the command to something that does work.

@@ -69,7 +69,7 @@ The file contains a set of keys and values, the list of keys is part of the PyPa

You can see the contents of the generated file like this::

tar xvfz dist/my-package-1.0.0.tar.gz -O | cat */PKG-INFO
tar xfz dist/my-package-1.0.0.tar.gz --wildcards --no-wildcards-match-slash -O '*/PKG-INFO'

This comment has been minimized.

@di

di Sep 16, 2018

Member

Using tar xfO dist/my-package-1.0.0.tar.gz */PKG-INFO would be simpler.

This comment has been minimized.

@jwodder

jwodder Sep 16, 2018

Author Contributor

Is the omission of --wildcards in your command intentional? tar on Ubuntu Xenial requires that option in order to enable pattern matching.

This comment has been minimized.

@di

di Sep 16, 2018

Member

Ah, nope, my tar must work differently (I'm using bsdtar 2.8.3). I get a tar: Option --wildcards is not supported trying to use that flag.

This comment has been minimized.

@jwodder

jwodder Sep 16, 2018

Author Contributor

I believe the lowest common denominator command would be tar xfO dist/my-package-1.0.0.tar.gz my-package-1.0.0/PKG-INFO, with the user typing out the project name & version twice. Should we go with that?

This comment has been minimized.

@pfmoore

pfmoore Sep 16, 2018

Member

For what it's worth, Windows 10 has tar available by default (at least the version I have does) - it's bsdtar 3.3.2 and that does support wildcards without needing an option. Specifically, tar xfO dist/my-package-1.0.0.tar.gz */PKG-INFO works.

Older versions of Windows almost certainly don't have tar, though.

This comment has been minimized.

@pfmoore

pfmoore Sep 16, 2018

Member

One problem with using wildcards, though - building a sdist appears to create a .egg-info directory that contains a copy of the metadata, so tar output (with wildcards) gets duplicated.

>tar tvf .\dist\pip-18.1.dev0.tar.gz */PKG-INFO
-rw-rw-rw-  0 0      0        3008 Sep 16 12:41 pip-18.1.dev0/PKG-INFO
-rw-rw-rw-  0 0      0        3008 Sep 16 12:41 pip-18.1.dev0/src/pip.egg-info/PKG-INFO

>tar xfO .\dist\pip-18.1.dev0.tar.gz */PKG-INFO | grep Name:
Name: pip
Name: pip

So the explicit version is probably better anyway.

@theacodes theacodes merged commit afbe530 into pypa:master Sep 17, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@theacodes

This comment has been minimized.

Copy link
Member

theacodes commented Sep 17, 2018

Thanks, @jwodder!

@jwodder jwodder deleted the jwodder:fix-tar-cmd branch Sep 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment