Skip to content

Commit

Permalink
package correct precalc data for Python 2.7 and 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Technologicat committed Apr 25, 2017
1 parent 277a1a5 commit fa6f9cd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,33 @@
sys.exit("Cython not found. Cython is needed to build the extension modules for pydgq.")


#########################################################
# HACK: Attempt to package the correct data file on POSIX
#########################################################

redirect_name = os.path.join("pydgq", "pydgq_data.bin")
file_27_name = os.path.join("pydgq", "pydgq_data_27.bin")
file_34_name = os.path.join("pydgq", "pydgq_data_34.bin")

# remove existing symlink or file if any
#
try:
os.remove( redirect_name )
except FileNotFoundError:
pass

# symlink correct file depending on Python version
#
# (FIXME/TODO: for now, we assume that setup.py is running under the same Python version the packaged library will run under)
#
if sys.version_info < (3,0):
print("Packaging %s as %s" % (file_27_name, redirect_name))
os.symlink( file_27_name, redirect_name )
else:
print("Packaging %s as %s" % (file_34_name, redirect_name))
os.symlink( file_34_name, redirect_name )


#########################################################
# Definitions
#########################################################
Expand Down Expand Up @@ -229,3 +256,11 @@ def ext_math(extName):
data_files = datafiles
)


# remove symlink created earlier
#
try:
os.remove( redirect_name )
except FileNotFoundError:
pass

0 comments on commit fa6f9cd

Please sign in to comment.