diff --git a/.gitignore b/.gitignore index 51888e7..7577d86 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ publish.sh -setup_publish_env.sh -bospm_publish_env -MANIFEST dist +build diff --git a/setup.py b/setup.py index 91030d2..8a3867f 100644 --- a/setup.py +++ b/setup.py @@ -13,52 +13,97 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from distutils.core import setup +from setuptools import setup, find_packages +from setuptools.command.install import install import os import sys +import shutil -this_directory = os.path.abspath(os.path.dirname(__file__)) +def post_install(): + # Determine the appropriate installation directory + if sys.platform.startswith('win'): + install_dir = os.path.join(os.environ.get('PROGRAMFILES', 'C:\\Program Files'), 'bospm') + script_dir = os.path.join(install_dir, 'Scripts') + os.makedirs(script_dir, exist_ok=True) + bat_path = os.path.join(script_dir, 'bospm.bat') + with open(bat_path, 'w') as f: + f.write('@echo off\n') + f.write(f'python "{os.path.join(install_dir, "bospm.py")}" %*') + else: # Unix-like systems (BellandeOS, Linux, macOS) + install_dir = '/usr/local/bospm' + bin_dir = '/usr/local/bin' + os.makedirs(install_dir, exist_ok=True) + os.makedirs(bin_dir, exist_ok=True) + script_path = os.path.join(bin_dir, 'bospm') + with open(script_path, 'w') as f: + f.write('#!/bin/bash\n') + f.write(f'python3 "{os.path.join(install_dir, "bospm.py")}" "$@"') + os.chmod(script_path, 0o755) -def read_file(filename): - with open(os.path.join(this_directory, filename), 'r', encoding='utf-8') as f: - return f.read() + # Copy the bospm.py script to the installation directory + src_path = os.path.join('src', 'bospm', 'bospm.py') + shutil.copy(src_path, install_dir) + print(f"bospm has been installed to {install_dir}") + if sys.platform.startswith('win'): + print("Please add the following directory to your PATH:") + print(script_dir) + else: + print("You can now use 'bospm' from anywhere in the terminal.") -long_description = read_file('README.md') +class PostInstallCommand(install): + def run(self): + install.run(self) + post_install() -# Determine the list of classifiers based on Python version -if sys.version_info[0] == 2: - python_classifiers = [ +# Read long description from README.md +with open("README.md", "r", encoding="utf-8") as fh: + long_description = fh.read() + +setup( + name="bospm", + version="0.1.1", + description="Bellande Operating System Package Manager", + long_description=long_description, + long_description_content_type="text/markdown", + author="Ronaldson Bellande", + author_email="ronaldsonbellande@gmail.com", + packages=find_packages(where="src"), + package_dir={"": "src"}, + include_package_data=True, + install_requires=[ + "requests>=2.25.1", + ], + classifiers=[ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", - ] -else: - python_classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", - ] - -setup( - name="bospm", - version="0.1.0", - author="Ronaldson Bellande", - author_email="ronaldsonbellande@gmail.com", - description="Bellande Operating System Package Manager", - long_description=long_description, - url="https://github.com/Algorithm-Model-Research/bellande_operating_system_package_manager", - packages=['bospm'], - package_dir={'bospm': 'src/bospm'}, - classifiers=[ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", - "Operating System :: OS Independent", - ] + python_classifiers, - requires=["requests (>=2.25.1)"], - scripts=['src/bospm/bospm.py'], + ], + python_requires=">=2.7", + extras_require={ + "dev": ["pytest", "pytest-cov[all]", "mypy", "black"], + }, + entry_points={ + 'console_scripts': [ + 'bospm = bospm.bospm:main', + ], + }, + project_urls={ + "Home": "https://github.com/Architecture-Mechanism/bellande_operating_system_package_manager", + "Bug Reports": "https://github.com/Architecture-Mechanism/bellande_operating_system_package_manager/issues", + "Source": "https://github.com/Architecture-Mechanism/bellande_operating_system_package_manager", + }, + cmdclass={ + 'install': PostInstallCommand, + }, license="GNU General Public License v3 or later (GPLv3+)", platforms=["any"], ) diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..05770a3 --- /dev/null +++ b/src/.gitignore @@ -0,0 +1 @@ +bospm.egg-info diff --git a/src/bospm/bospm.py b/src/bospm/bospm.py index 35b6355..0cc978e 100644 --- a/src/bospm/bospm.py +++ b/src/bospm/bospm.py @@ -34,8 +34,8 @@ REPO_DIR = os.path.join(CONFIG_DIR, 'repo') INSTALL_DIR = os.path.join(CONFIG_DIR, 'installed') # Repository and website URLs -GITHUB_REPO = "https://github.com/Algorithm-Model-Research/bellande_operating_system_package" -TEMP_WEBSITE = "https://example.com/bospm_packages" # Temporary website URL +GITHUB_REPO = "https://github.com/Architecture-Mechanism/bellande_operating_system_package" +TEMP_WEBSITE = "https://bellande-architecture-mechanism-research-innovation-center.org/bospm_packages" # Temporary website URL def ensure_dirs(): for dir in [CONFIG_DIR, PACKAGE_DIR, REPO_DIR, INSTALL_DIR]: