-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
sage --package create --pypi
: Create a wheel package by default if possible
#36794
Changes from all commits
d25284e
af414b6
ec28623
818468a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
tarball=six-VERSION.tar.gz | ||
sha1=06fa0bb50f2a4e2917fd14c21e9d2d5508ce0163 | ||
md5=a7c927740e4964dd29b72cebfc1429bb | ||
cksum=1693137720 | ||
upstream_url=https://pypi.io/packages/source/s/six/six-VERSION.tar.gz | ||
tarball=six-VERSION-py2.py3-none-any.whl | ||
sha1=79e6f2e4f9e24898f1896df379871b9c9922f147 | ||
md5=529d7fd7e14612ccde86417b4402d6f3 | ||
cksum=2975792266 | ||
upstream_url=https://pypi.io/packages/py2.py3/s/six/six-VERSION-py2.py3-none-any.whl |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
| $(PYTHON_TOOLCHAIN) $(PYTHON) | ||
| pip $(PYTHON) | ||
|
||
---------- | ||
All lines of this file are ignored except the first. |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,7 +273,7 @@ def fix_checksum(self, package_name): | |
update.fix_checksum() | ||
|
||
def create(self, package_name, version=None, tarball=None, pkg_type=None, upstream_url=None, | ||
description=None, license=None, upstream_contact=None, pypi=False, source='normal'): | ||
description=None, license=None, upstream_contact=None, pypi=False, source=None): | ||
""" | ||
Create a package | ||
|
||
|
@@ -288,6 +288,14 @@ def create(self, package_name, version=None, tarball=None, pkg_type=None, upstre | |
if '-' in package_name: | ||
raise ValueError('package names must not contain dashes, use underscore instead') | ||
if pypi: | ||
if source is None: | ||
try: | ||
if PyPiVersion(package_name, source='wheel').tarball.endswith('-none-any.whl'): | ||
source = 'wheel' | ||
else: | ||
source = 'normal' | ||
except PyPiError: | ||
source = 'normal' | ||
pypi_version = PyPiVersion(package_name, source=source) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if source is None:
try:
- source = 'wheel'
- if not PyPiVersion(package_name, source='wheel').tarball.endswith('-none-any.whl'):
+ if PyPiVersion(package_name, source='wheel').tarball.endswith('-none-any.whl'):
+ source = 'wheel'
+ else
source = 'normal'
except PyPiError: a bit simpler code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, done in 818468a |
||
if source == 'normal': | ||
if not tarball: | ||
|
@@ -312,6 +320,10 @@ def create(self, package_name, version=None, tarball=None, pkg_type=None, upstre | |
license = pypi_version.license | ||
if not upstream_contact: | ||
upstream_contact = pypi_version.package_url | ||
if upstream_url and not tarball: | ||
tarball = upstream_url.rpartition('/')[2] | ||
if tarball and source is None: | ||
source = 'normal' | ||
if tarball and not pkg_type: | ||
# If we set a tarball, also make sure to create a "type" file, | ||
# so that subsequent operations (downloading of tarballs) work. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -319,7 +319,7 @@ def make_parser(): | |
'package_name', default=None, type=str, | ||
help='Package name.') | ||
parser_create.add_argument( | ||
'--source', type=str, default='normal', help='Package source (one of normal, wheel, script, pip)') | ||
'--source', type=str, default=None, help='Package source (one of normal, wheel, script, pip); default depends on provided arguments') | ||
parser_create.add_argument( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. parser_create.add_argument(
- '--source', type=str, default=None, help='Package source (one of normal, wheel, script, pip; default depends on provided arguments)')
+ '--source', type=str, default=None, help='Package source (one of normal, wheel, script, pip); default depends on provided arguments')
parser_create.add_argument(
'--version', type=str, default=None, help='Package version') following the style of other arguments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in 818468a |
||
'--version', type=str, default=None, help='Package version') | ||
parser_create.add_argument( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PYTHON_TOOLCHAIN
represents "a prerequisite to any pip-installed packages". It does not differentiate source and wheel python packages. Here changing it with just "pip" signals thatPYTHON_TOOLCHAIN
is only for source python packages. Is it?On the other hand, packages in
PYTHON_TOOLCHAIN
are installed anyway because of other packages. So it seems that the change has no real benefit...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I have updated the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. OK.