Skip to content

Commit

Permalink
more trying
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Mommert committed Aug 26, 2017
1 parent 7a224c5 commit 30e9c97
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 36 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ recursive-include astropy_helpers/licenses *
include astropy_helpers/ez_setup.py
include astropy_helpers/ah_bootstrap.py

recursive-include astropy_helpers/astropy_helpers *.py *.pyx *.c *.h *.rst
recursive-include astropy_helpers/astropy_helpers *.py *.pyx *.c *.h
recursive-include astropy_helpers/astropy_helpers.egg-info *
# include the sphinx stuff with "*" because there are css/html/rst/etc.
recursive-include astropy_helpers/astropy_helpers/sphinx *
Expand Down
36 changes: 29 additions & 7 deletions ez_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
Maintained at https://github.com/pypa/setuptools/tree/bootstrap.
Run this script to install or upgrade setuptools.
This method is DEPRECATED. Check https://github.com/pypa/setuptools/issues/581 for more details.
"""

import os
Expand All @@ -20,29 +18,30 @@
import platform
import textwrap
import contextlib
import json
import codecs

from distutils import log

try:
from urllib.request import urlopen
from urllib.parse import urljoin
except ImportError:
from urllib2 import urlopen
from urlparse import urljoin

try:
from site import USER_SITE
except ImportError:
USER_SITE = None

# 33.1.1 is the last version that supports setuptools self upgrade/installation.
DEFAULT_VERSION = "33.1.1"
LATEST = object()
DEFAULT_VERSION = LATEST
DEFAULT_URL = "https://pypi.io/packages/source/s/setuptools/"
DEFAULT_SAVE_DIR = os.curdir
DEFAULT_DEPRECATION_MESSAGE = "ez_setup.py is deprecated and when using it setuptools will be pinned to {0} since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools"

MEANINGFUL_INVALID_ZIP_ERR_MSG = 'Maybe {0} is corrupted, delete it and try again.'

log.warn(DEFAULT_DEPRECATION_MESSAGE.format(DEFAULT_VERSION))


def _python_cmd(*args):
"""
Expand Down Expand Up @@ -158,6 +157,7 @@ def use_setuptools(
Return None. Raise SystemExit if the requested version
or later cannot be installed.
"""
version = _resolve_version(version)
to_dir = os.path.abspath(to_dir)

# prior to importing, capture the module state for
Expand Down Expand Up @@ -344,6 +344,7 @@ def download_setuptools(
``downloader_factory`` should be a function taking no arguments and
returning a function for downloading a URL to a target.
"""
version = _resolve_version(version)
# making sure we use the absolute path
to_dir = os.path.abspath(to_dir)
zip_name = "setuptools-%s.zip" % version
Expand All @@ -356,6 +357,27 @@ def download_setuptools(
return os.path.realpath(saveto)


def _resolve_version(version):
"""
Resolve LATEST version
"""
if version is not LATEST:
return version

meta_url = urljoin(DEFAULT_URL, '/pypi/setuptools/json')
resp = urlopen(meta_url)
with contextlib.closing(resp):
try:
charset = resp.info().get_content_charset()
except Exception:
# Python 2 compat; assume UTF-8
charset = 'UTF-8'
reader = codecs.getreader(charset)
doc = json.load(reader(resp))

return str(doc['info']['version'])


def _build_install_args(options):
"""
Build the arguments to 'python setup.py install' on the setuptools package.
Expand Down
10 changes: 5 additions & 5 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
conda:
file: .rtd-environment.yml

python:
setup_py_install: true
#conda:
# file: .rtd-environment.yml
#
#python:
# setup_py_install: true
7 changes: 3 additions & 4 deletions sbpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from ._astropy_init import *
# ----------------------------------------------------------------------------

if not _ASTROPY_SETUP_:
# For egg_info test builds to pass, put package imports here.

pass

# For egg_info test builds to pass, put package imports here.
# if not _ASTROPY_SETUP_:
# from sbpy import *
10 changes: 1 addition & 9 deletions sbpy/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@
from astropy.tests.pytest_plugins import *

## Uncomment the following line to treat all DeprecationWarnings as
## exceptions. For Astropy v2.0 or later, there are 2 additional keywords,
## as follow (although default should work for most cases).
## To ignore some packages that produce deprecation warnings on import
## (in addition to 'compiler', 'scipy', 'pygments', 'ipykernel', and
## 'setuptools'), add:
## modules_to_ignore_on_import=['module_1', 'module_2']
## To ignore some specific deprecation warning messages for Python version
## MAJOR.MINOR or later, add:
## warnings_to_ignore_by_pyver={(MAJOR, MINOR): ['Message to ignore']}
## exceptions
# enable_deprecations_as_exceptions()

## Uncomment and customize the following lines to add/remove entries from
Expand Down
10 changes: 5 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ exclude = extern,sphinx,*parsetab.py

[metadata]
package_name = sbpy
description = A Python package for asteroid and comet research
long_description = An Astropy affiliated package for small-body planetary astronomy
description = A Python Module for Planetary Astronomy
long_description = A Python Module for Asteroid and Comet Research
author = sbpy team
author_email = michael.mommert@nau.edu
license = BSD 3-Clause
url = http://github.com/mommermi/sbpy
edit_on_github = True
url = http://www.github.com/mommermi/sbpy
edit_on_github = False
github_project = mommermi/sbpy
# version should be PEP386 compatible (http://www.python.org/dev/peps/pep-0386)
version = 0.0.dev

[entry_points]

# astropy-package-template-example = packagename.example_mod:main
astropy-package-template-example = packagename.example_mod:main

13 changes: 8 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
metadata = dict(conf.items('metadata'))

PACKAGENAME = metadata.get('package_name', 'sbpy')
DESCRIPTION = metadata.get('description', 'A Python package for asteroid and comet research')
DESCRIPTION = metadata.get('description', 'A Python Module for Small-Body Planetary Astronomy')
AUTHOR = metadata.get('author', 'sbpy team')
AUTHOR_EMAIL = metadata.get('author_email', '')
LICENSE = metadata.get('license', 'unknown')
URL = metadata.get('url', 'http://github.com/mommermi/sbpy')
AUTHOR_EMAIL = metadata.get('author_email', 'michael.mommert@nau.edu')
LICENSE = metadata.get('license', 'BSD 3-Clause')
URL = metadata.get('url', 'http://www.github.com/mommermi/sbpy')

# order of priority for long_description:
# (1) set in setup.cfg,
Expand Down Expand Up @@ -66,7 +66,7 @@
builtins._ASTROPY_PACKAGE_NAME_ = PACKAGENAME

# VERSION should be PEP440 compatible (http://www.python.org/dev/peps/pep-0440)
VERSION = metadata.get('version', '0.0.55dev')
VERSION = metadata.get('version', '0.0.dev')

# Indicates if this version is a release version
RELEASE = 'dev' not in VERSION
Expand Down Expand Up @@ -106,6 +106,9 @@
entry_points['console_scripts'].append('{0} = {1}'.format(
entry_point[0], entry_point[1]))

# entry points for the Ginga viewer
entry_points['ginga.rv.plugins'] = ['cometaryenhancements = sbpy.ginga_plugins:setup_cometaryenhancements']

# Include all .c files, recursively, including those generated by
# Cython, since we can not do this in MANIFEST.in with a "dynamic"
# directory name.
Expand Down

0 comments on commit 30e9c97

Please sign in to comment.