latest pushes

This commit is contained in:
Ronaldson Bellande 2024-10-10 20:52:27 -04:00
parent 1f68da497b
commit ea7bf559c8
4 changed files with 81 additions and 37 deletions

4
.gitignore vendored
View File

@ -1,5 +1,3 @@
publish.sh publish.sh
setup_publish_env.sh
bospm_publish_env
MANIFEST
dist dist
build

109
setup.py
View File

@ -13,52 +13,97 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
from distutils.core import setup from setuptools import setup, find_packages
from setuptools.command.install import install
import os import os
import sys 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): # Copy the bospm.py script to the installation directory
with open(os.path.join(this_directory, filename), 'r', encoding='utf-8') as f: src_path = os.path.join('src', 'bospm', 'bospm.py')
return f.read() 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 # Read long description from README.md
if sys.version_info[0] == 2: with open("README.md", "r", encoding="utf-8") as fh:
python_classifiers = [ 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",
"Programming Language :: Python :: 2.7", "Programming Language :: Python :: 2.7",
]
else:
python_classifiers = [
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.10",
] ],
python_requires=">=2.7",
setup( extras_require={
name="bospm", "dev": ["pytest", "pytest-cov[all]", "mypy", "black"],
version="0.1.0", },
author="Ronaldson Bellande", entry_points={
author_email="ronaldsonbellande@gmail.com", 'console_scripts': [
description="Bellande Operating System Package Manager", 'bospm = bospm.bospm:main',
long_description=long_description, ],
url="https://github.com/Algorithm-Model-Research/bellande_operating_system_package_manager", },
packages=['bospm'], project_urls={
package_dir={'bospm': 'src/bospm'}, "Home": "https://github.com/Architecture-Mechanism/bellande_operating_system_package_manager",
classifiers=[ "Bug Reports": "https://github.com/Architecture-Mechanism/bellande_operating_system_package_manager/issues",
"Development Status :: 3 - Alpha", "Source": "https://github.com/Architecture-Mechanism/bellande_operating_system_package_manager",
"Intended Audience :: Developers", },
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", cmdclass={
"Operating System :: OS Independent", 'install': PostInstallCommand,
] + python_classifiers, },
requires=["requests (>=2.25.1)"],
scripts=['src/bospm/bospm.py'],
license="GNU General Public License v3 or later (GPLv3+)", license="GNU General Public License v3 or later (GPLv3+)",
platforms=["any"], platforms=["any"],
) )

1
src/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
bospm.egg-info

View File

@ -34,8 +34,8 @@ REPO_DIR = os.path.join(CONFIG_DIR, 'repo')
INSTALL_DIR = os.path.join(CONFIG_DIR, 'installed') INSTALL_DIR = os.path.join(CONFIG_DIR, 'installed')
# Repository and website URLs # Repository and website URLs
GITHUB_REPO = "https://github.com/Algorithm-Model-Research/bellande_operating_system_package" GITHUB_REPO = "https://github.com/Architecture-Mechanism/bellande_operating_system_package"
TEMP_WEBSITE = "https://example.com/bospm_packages" # Temporary website URL TEMP_WEBSITE = "https://bellande-architecture-mechanism-research-innovation-center.org/bospm_packages" # Temporary website URL
def ensure_dirs(): def ensure_dirs():
for dir in [CONFIG_DIR, PACKAGE_DIR, REPO_DIR, INSTALL_DIR]: for dir in [CONFIG_DIR, PACKAGE_DIR, REPO_DIR, INSTALL_DIR]: