Skip to content
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
Merged

Replace tar command with something that works #552

merged 2 commits into from
Sep 17, 2018

Conversation

jwodder
Copy link
Contributor

@jwodder 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'
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@theacodes
Copy link
Member

Thanks, @jwodder!

@jwodder jwodder deleted the fix-tar-cmd branch September 24, 2018 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants