Skip to content

Commit

Permalink
Don't rely on .git to enable auto-build when importing from source tr…
Browse files Browse the repository at this point in the history
…ee (since this won't work for source tarball distributions. Adds a new .astropy-root file that allows fairly unambiguous identification of the root of the source tree (better even than setup.py)
  • Loading branch information
embray committed Jul 9, 2015
1 parent 296b8f7 commit 8231799
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Empty file added .astropy-root
Empty file.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include .astropy-root
include README.rst
include CHANGES.rst

Expand Down
5 changes: 2 additions & 3 deletions astropy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,8 @@ def _initialize_astropy():

# If this __init__.py file is in ./astropy/ then import is within a source dir
source_dir = os.path.abspath(os.path.dirname(__file__))
is_astropy_source_dir = (
os.path.exists(os.path.join(source_dir, os.pardir, '.git')) and
os.path.isfile(os.path.join(source_dir, os.pardir, 'setup.py')))
is_astropy_source_dir = os.path.exists(os.path.join(source_dir, os.pardir,
'.astropy-root'))

def _rollback_import(message):
log.error(message)
Expand Down

0 comments on commit 8231799

Please sign in to comment.