another attempt at working setup.py
This commit is contained in:
parent
f417a55f22
commit
08a4c41caa
1 changed files with 23 additions and 28 deletions
51
setup.py
51
setup.py
|
@ -1,24 +1,17 @@
|
|||
#!/usr/bin/env python3
|
||||
from setuptools import setup
|
||||
from os.path import abspath, dirname, join, isfile, isdir
|
||||
from os import walk
|
||||
import os
|
||||
from os import walk, path
|
||||
|
||||
# Define package information
|
||||
SKILL_CLAZZ = "KagiSkill" # Make sure it matches __init__.py class name
|
||||
VERSION = "0.0.1"
|
||||
URL = "https://code.sitosis.com/rudism/skill-ovos-fallback-kagi"
|
||||
AUTHOR = "Rudism"
|
||||
EMAIL = "rudis@sitosis.com"
|
||||
LICENSE = "Apache2.0"
|
||||
DESCRIPTION = SKILL_CLAZZ # TODO
|
||||
|
||||
PYPI_NAME = URL.split("/")[-1] # pip install PYPI_NAME
|
||||
|
||||
# Construct entry point for plugin
|
||||
SKILL_ID = f"{PYPI_NAME.lower()}.{AUTHOR.lower()}"
|
||||
SKILL_PKG = PYPI_NAME.lower().replace('-', '_')
|
||||
PLUGIN_ENTRY_POINT = f"{SKILL_ID}={SKILL_PKG}:{SKILL_CLAZZ}"
|
||||
PYPI_NAME = "skill-ovos-fallback-kagi" # pip install PYPI_NAME
|
||||
URL = f"https://code.sitosis.com/rudism/{PYPI_NAME}"
|
||||
SKILL_CLAZZ = "KagiSkill" # needs to match __init__.py class name
|
||||
|
||||
# below derived from github url to ensure standard skill_id
|
||||
SKILL_AUTHOR, SKILL_NAME = URL.split(".com/")[-1].split("/")
|
||||
SKILL_PKG = SKILL_NAME.lower().replace('-', '_')
|
||||
PLUGIN_ENTRY_POINT = f'{SKILL_NAME.lower()}.{SKILL_AUTHOR.lower()}={SKILL_PKG}:{SKILL_CLAZZ}'
|
||||
# skill_id=package_name:SkillClass
|
||||
|
||||
# Function to parse requirements from file
|
||||
def get_requirements(requirements_filename: str = "requirements.txt"):
|
||||
|
@ -33,29 +26,31 @@ def get_requirements(requirements_filename: str = "requirements.txt"):
|
|||
return requirements
|
||||
return []
|
||||
|
||||
|
||||
# Function to find resource files
|
||||
def find_resource_files():
|
||||
resource_base_dirs = ("locale", "ui", "vocab", "dialog", "regex", "skill")
|
||||
base_dir = abspath(dirname(__file__))
|
||||
base_dir = path.dirname(__file__)
|
||||
package_data = ["*.json"]
|
||||
for res in resource_base_dirs:
|
||||
if isdir(join(base_dir, res)):
|
||||
for (directory, _, files) in walk(join(base_dir, res)):
|
||||
if path.isdir(path.join(base_dir, res)):
|
||||
for (directory, _, files) in walk(path.join(base_dir, res)):
|
||||
if files:
|
||||
package_data.append(join(directory.replace(base_dir, "").lstrip('/'), '*'))
|
||||
package_data.append(
|
||||
path.join(directory.replace(base_dir, "").lstrip('/'),
|
||||
'*'))
|
||||
return package_data
|
||||
|
||||
|
||||
# Setup configuration
|
||||
setup(
|
||||
name=PYPI_NAME,
|
||||
version=VERSION,
|
||||
description=DESCRIPTION,
|
||||
version=get_version(),
|
||||
description='ovos Kagi skill',
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url=URL,
|
||||
author=AUTHOR,
|
||||
author_email=EMAIL,
|
||||
license=LICENSE,
|
||||
author='Rudis Muiznieks',
|
||||
author_email='rudis@sitosis.com',
|
||||
license='Apache-2.0',
|
||||
package_dir={SKILL_PKG: ""},
|
||||
package_data={SKILL_PKG: find_resource_files()},
|
||||
packages=[SKILL_PKG],
|
||||
|
|
Loading…
Add table
Reference in a new issue