diff --git a/comfortable_swipe/__main__.py b/scripts/comfortable-swipe old mode 100644 new mode 100755 similarity index 90% rename from comfortable_swipe/__main__.py rename to scripts/comfortable-swipe index ab1947e..f425b7b --- a/comfortable_swipe/__main__.py +++ b/scripts/comfortable-swipe @@ -1,5 +1,3 @@ -from __future__ import print_function - import sys from comfortable_swipe import service diff --git a/setup.py b/setup.py index e27428f..703d644 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,10 @@ import os +import sys from setuptools import setup, find_packages from setuptools.extension import Extension +__BIN__ = os.path.dirname(sys.executable) +_SHARE_ = os.path.join(os.path.dirname(__BIN__), 'share') __CWD__ = os.getcwd() __DIR__ = os.path.abspath(os.path.dirname(__file__)) __URL__ = 'https://github.com/Hikari9/comfortable-swipe-ubuntu' @@ -9,8 +12,8 @@ __URL__ = 'https://github.com/Hikari9/comfortable-swipe-ubuntu' NAME = 'comfortable-swipe' PYTHON_NAME = NAME.replace('-', '_') VERSION = '1.1.0' -PROGRAM = os.path.join('/usr/local/bin', NAME) -CONFIG = os.path.join('/usr/local/share', NAME, NAME + '.conf') +PROGRAM = os.path.join(__BIN__, NAME) +CONFIG = os.path.join(_SHARE_, NAME, NAME + '.conf') # for C++ library cpp_macros = dict( @@ -23,6 +26,10 @@ try: # make sure working directory is here os.chdir(__DIR__) + # make sure paths to program and config exist + os.makedirs(os.path.dirname(PROGRAM), exist_ok=True) + os.makedirs(os.path.dirname(CONFIG), exist_ok=True) + # save README as long_description with open('README.md', 'r') as README_file: README = README_file.read() @@ -52,6 +59,7 @@ try: author_email='thericotiongson@gmail.com', url=__URL__, packages=find_packages(), + scripts=['scripts/comfortable-swipe'], ext_modules=extensions )