-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from NOAA-MDL/issue#30
Create new directory for ephemeris files where skyfield is installed.
- Loading branch information
Showing
3 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
import os | ||
import sys | ||
import setuptools | ||
|
||
setuptools.setup() | ||
# | ||
# Find skyfield module location | ||
try: | ||
# | ||
# If skyfield was installed before GIFTs | ||
import skyfield | ||
|
||
bsp_directory = os.path.join(skyfield.__path__[0], 'bsp_files') | ||
if not os.path.exists(bsp_directory): | ||
os.mkdir(bsp_directory) | ||
os.chmod(bsp_directory, 0o777) | ||
|
||
except ModuleNotFoundError: | ||
# | ||
# Newly installed with GIFTs | ||
site_package_dir = os.path.join(sys.prefix, 'lib', 'python{}.{}'.format(sys.version_info.major, | ||
sys.version_info.minor), 'site-packages') | ||
egg_ext = '-py{}.{}.egg'.format(sys.version_info.major, sys.version_info.minor) | ||
|
||
for d in os.listdir(site_package_dir): | ||
if d.startswith('skyfield') and d.endswith(egg_ext): | ||
os.mkdir(os.path.join(site_package_dir, d, 'skyfield', 'bsp_files')) | ||
os.chmod(os.path.join(site_package_dir, d, 'skyfield', 'bsp_files'), 0o777) | ||
break | ||
else: | ||
print("Unable to create bsp_files directory for skyfield module. Please create it manually with user & group " | ||
"write permissions") |