Skip to content

Commit

Permalink
Reorganize project files
Browse files Browse the repository at this point in the history
- move sources to /src/cuesdk folder
- move binaries to /bin folder
- update setup.py
  • Loading branch information
intrueder committed May 26, 2022
1 parent 6af9803 commit 674651a
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 43 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
80 changes: 39 additions & 41 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import os
import platform
import re
from setuptools import setup
from setuptools import setup, find_packages


def read_version(filename='cuesdk/version.py'):
def read_version(filename='src/cuesdk/version.py'):
"""Parse a __version__ number from a source file"""
with open(filename) as source:
text = source.read()
match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", text)
if not match:
msg = "Unable to find version number in {}".format(filename)
msg = 'Unable to find version number in {}'.format(filename)
raise RuntimeError(msg)
version = match.group(1)
return version
Expand All @@ -19,48 +19,46 @@ def read_version(filename='cuesdk/version.py'):
system = platform.system().lower()

if system not in ('windows', 'darwin'):
msg = "{} system is not supported".format(system)
msg = '{} system is not supported'.format(system)
raise RuntimeError(msg)


def package_files(directory):
return [
os.path.join('..', path, filename)
for (path, directories, filenames) in os.walk(directory)
def get_data_files(directory):
files = [
os.path.join(dirpath, filename)
for (dirpath, _, filenames) in os.walk(directory)
for filename in filenames
]
return files


setup(
name="cuesdk",
version=read_version(),
packages=['cuesdk'],
package_data={
'cuesdk': package_files('cuesdk/bin'),
},
zip_safe=False,
author="Corsair Memory, Inc.",
license='MIT',
url="https://github.com/CorsairOfficial/cue-sdk-python",
description="Ctypes-based CUE SDK binding for Python",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
install_requires=[],
python_requires='>=3.7',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: MIT License',
'Operating System :: MacOS',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Games/Entertainment',
'Topic :: System :: Hardware'
]
)
setup(name="cuesdk",
version=read_version(),
packages=find_packages('src'),
package_dir={'': 'src'},
data_files=[('bin', get_data_files('bin'))],
zip_safe=False,
author='Corsair Memory, Inc.',
license='MIT',
url='https://github.com/CorsairOfficial/cue-sdk-python',
description='Ctypes-based CUE SDK binding for Python',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
install_requires=[],
python_requires='>=3.7',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: MIT License',
'Operating System :: MacOS',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Games/Entertainment',
'Topic :: System :: Hardware'
])
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions cuesdk/capi.py → src/cuesdk/capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
def get_library_path_windows():
suffix = '.x64' if sizeof(c_void_p) == 8 else ''
lib_name = 'CUESDK' + suffix + '_2017.dll'
return os.path.join(os.path.dirname(__file__), 'bin', lib_name)
return os.path.join(sys.prefix, 'bin', lib_name)


def get_library_path_mac():
lib_name = 'libCUESDK.dylib'
return os.path.join(os.path.dirname(__file__), 'bin', lib_name)
return os.path.join(sys.prefix, 'bin', lib_name)


def load_library(library_path):
Expand All @@ -32,6 +32,7 @@ def load_library(library_path):


class CorsairNativeApi():

def __init__(self, libpath):
if libpath is None:
system = platform.system()
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 674651a

Please sign in to comment.