# Buggy code
def __init__(self, name, *args):
    # If the user provided `--name py-pyqt4`, don't rename it py-py-pyqt4
    if not name.startswith("py-"):
        # Make it more obvious that we are renaming the package
        tty.msg("Changing package name from {0} to py-{0}".format(name))
        name = "py-{0}".format(name)

    super(SIPPackageTemplate, self).__init__(name, *args)


# Traceback (TypeError)
$ spack -d create https://pypi.io/packages/source/P/PyJWT/PyJWT-1.7.1.tar.gz
==> [2019-08-22-15:47:19.578845] Imported create from built-in commands
==> [2019-08-22-15:47:19.581250] Imported create from built-in commands
==> [2019-08-22-15:47:19.779743] Reading config file /disk/home/sinan/Downloads/spack/etc/spack/defaults/modules.yaml
==> [2019-08-22-15:47:19.797824] Reading config file /disk/home/sinan/Downloads/spack/etc/spack/defaults/linux/modules.yaml
==> [2019-08-22-15:47:19.802880] Reading config file /disk/home/sinan/Downloads/spack/etc/spack/defaults/config.yaml
==> [2019-08-22-15:47:19.841457] This looks like a URL for PyJWT
==> [2019-08-22-15:47:19.842703] Warning: Spack will not check SSL certificates. You need to update your Python to enable certificate verification.
==> [2019-08-22-15:47:19.915762] HTTPError: HTTP Error 404: Not Found
==> [2019-08-22-15:47:19.917359] Warning: Spack will not check SSL certificates. You need to update your Python to enable certificate verification.
==> [2019-08-22-15:47:20.027930] HTTPError: HTTP Error 404: Not Found
==> [2019-08-22-15:47:20.043323] Found 1 version of pyjwt:

1.7.1  https://pypi.io/packages/source/P/PyJWT/PyJWT-1.7.1.tar.gz

==> [2019-08-22-15:47:20.043999] How many would you like to checksum? (default is 1, q to abort)
==> [2019-08-22-15:47:22.017241] Downloading...
==> [2019-08-22-15:47:22.021265] WRITE LOCK: /cache/spack-stage/sinan/.lock[2324237983255820602:1] [Acquiring]
==> [2019-08-22-15:47:22.021765] WRITE LOCK: /cache/spack-stage/sinan/.lock[2324237983255820602:1] [Acquired]
==> [2019-08-22-15:47:22.022706] Fetching https://pypi.io/packages/source/P/PyJWT/PyJWT-1.7.1.tar.gz
==> [2019-08-22-15:47:22.025637] '/usr/bin/curl' '-C' '-' '-o' '/cache/spack-stage/sinan/spack-stage-1RRl5T/PyJWT-1.7.1.tar.gz.part' '-f' '-D' '-' '-L' 'https://pypi.io/packages/source/P/PyJWT/PyJWT-1.7.1.tar.gz' '-#'
######################################################################## 100.0%
==> [2019-08-22-15:47:22.314185] '/usr/bin/tar' '--exclude=*/*/*' '-tf' '/cache/spack-stage/sinan/spack-stage-1RRl5T/PyJWT-1.7.1.tar.gz'
==> [2019-08-22-15:47:22.320293] WRITE LOCK: /cache/spack-stage/sinan/.lock[2324237983255820602:1] [Released]
==> [2019-08-22-15:47:22.320423] Checksummed 1 version of pyjwt
==> [2019-08-22-15:47:22.320472] This package looks like it uses the python build system
Traceback (most recent call last):
File "/disk/home/sinan/Downloads/spack/bin/spack", line 48, in <module>
sys.exit(spack.main.main())
File "/disk/home/sinan/Downloads/spack/lib/spack/spack/main.py", line 697, in main
return _invoke_command(command, parser, args, unknown)
File "/disk/home/sinan/Downloads/spack/lib/spack/spack/main.py", line 447, in _invoke_command
return_val = command(parser, args)
File "/disk/home/sinan/Downloads/spack/lib/spack/spack/cmd/create.py", line 719, in create
package = package_class(**constr_args)
TypeError: __init__() got an unexpected keyword argument 'url'

# Fixed code
def __init__(self, name, *args, **kwargs):
    # If the user provided `--name py-pyqt4`, don't rename it py-py-pyqt4
    if not name.startswith("py-"):
        # Make it more obvious that we are renaming the package
        tty.msg("Changing package name from {0} to py-{0}".format(name))
        name = "py-{0}".format(name)

    super(SIPPackageTemplate, self).__init__(name, *args, **kwargs)