Fix compilation for Python 3

This commit is contained in:
Rico Tiongson 2019-03-02 18:05:37 +08:00
parent f789ed4ee5
commit abef078c58
2 changed files with 10 additions and 4 deletions

View File

@ -1,5 +1,3 @@
from __future__ import print_function
import sys
from comfortable_swipe import service

View File

@ -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
)