battleschool icon indicating copy to clipboard operation
battleschool copied to clipboard

Drop `DIST_MODULE_PATH`

Open dochang opened this issue 9 years ago • 7 comments

People may install python into a non-standard location other than /usr, such as $HOME. That means DIST_MODULE_PATH should be always based on sys.prefix.

dochang avatar Jul 18 '15 18:07 dochang

Now DIST_MODULE_PATH has been removed. Data files location will not be related with sys.prefix.

dochang avatar Nov 07 '15 19:11 dochang

You'll have to walk me through all of your changes. I don't understand them. Also, please rebase.

spencergibb avatar Nov 07 '15 20:11 spencergibb

This patch installs data files (the share directory) into the same location of *.py files. No files will be installed into /usr/local/share/battleschool or os.path.join(sys.prefix, 'share/battleschool') any more.

The effect is: we can access library/mac_pkg or defaults/hosts via pkg_resources API, rather than DIST_MODULE_PATH. So, we can remove DIST_MODULE_PATH completely.

dochang avatar Nov 08 '15 10:11 dochang

This patch has been rebased to master. Should I rebase it back to the original commit (49d8c12) ?

dochang avatar Nov 08 '15 10:11 dochang

Installs on my mac to /Library/Python/2.7/site-packages/battleschool which according to the About System Integrity Protection page is ok.

spencergibb avatar Nov 09 '15 18:11 spencergibb

The following works for me:

def get_share_path(*paths):
    lib_path = os.path.dirname(__file__)
    share_path = os.path.join(lib_path, 'share')
    return os.path.join(share_path, *paths)

@dochang any objections?

spencergibb avatar Nov 09 '15 18:11 spencergibb

Dropped pkg_resources and setuptools. @spencergibb

dochang avatar Nov 10 '15 08:11 dochang