parent
eddf81a730
commit
b6003a2815
|
@ -0,0 +1 @@
|
||||||
|
include LICENSE
|
|
@ -16,3 +16,54 @@ GNU General Public License for more details.
|
||||||
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 pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
from . import config
|
||||||
|
from . import parse
|
||||||
|
from .helpers import frontend
|
||||||
|
from .helpers import logging as pmb_logging
|
||||||
|
from .helpers import other
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# Parse arguments, set up logging
|
||||||
|
args = parse.arguments()
|
||||||
|
pmb_logging.init(args)
|
||||||
|
|
||||||
|
# Wrap everything to display nice error messages
|
||||||
|
try:
|
||||||
|
# Sanity check
|
||||||
|
other.check_grsec(args)
|
||||||
|
|
||||||
|
# Initialize or require config
|
||||||
|
if args.action == "init":
|
||||||
|
return config.init(args)
|
||||||
|
elif not os.path.exists(args.config):
|
||||||
|
logging.critical("Please specify a config file, or run"
|
||||||
|
" 'pmbootstrap init' to generate one.")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
# Run the function with the action's name (in pmb/helpers/frontend.py)
|
||||||
|
if args.action:
|
||||||
|
getattr(frontend, args.action)(args)
|
||||||
|
else:
|
||||||
|
logging.info("Run pmbootstrap -h for usage information.")
|
||||||
|
|
||||||
|
# Print finish timestamp
|
||||||
|
logging.info("Done")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logging.info("ERROR: " + str(e))
|
||||||
|
logging.info("Run 'pmbootstrap log' for details.")
|
||||||
|
logging.info("See also: <https://postmarketos.org/troubleshooting>")
|
||||||
|
logging.debug(traceback.format_exc())
|
||||||
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
|
|
|
@ -28,6 +28,11 @@ def deviceinfo(args, device=None):
|
||||||
if not device:
|
if not device:
|
||||||
device = args.device
|
device = args.device
|
||||||
|
|
||||||
|
if not os.path.exists(args.aports):
|
||||||
|
logging.fatal("Aports directory is missing")
|
||||||
|
logging.fatal("Please provide a path to the aports directory using the -p flag")
|
||||||
|
raise RuntimeError("Aports directory missing")
|
||||||
|
|
||||||
aport = args.aports + "/device/device-" + device
|
aport = args.aports + "/device/device-" + device
|
||||||
if not os.path.exists(aport) or not os.path.exists(aport + "/deviceinfo"):
|
if not os.path.exists(aport) or not os.path.exists(aport + "/deviceinfo"):
|
||||||
logging.fatal("You will need to create a device-specific package")
|
logging.fatal("You will need to create a device-specific package")
|
||||||
|
|
|
@ -20,50 +20,7 @@ along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import pmb
|
||||||
import os
|
|
||||||
import traceback
|
|
||||||
import pmb.config
|
|
||||||
import pmb.helpers.frontend
|
|
||||||
import pmb.helpers.logging
|
|
||||||
import pmb.helpers.other
|
|
||||||
import pmb.parse
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
# Parse arguments, set up logging
|
|
||||||
args = pmb.parse.arguments()
|
|
||||||
pmb.helpers.logging.init(args)
|
|
||||||
|
|
||||||
# Wrap everything to display nice error messages
|
|
||||||
try:
|
|
||||||
# Sanity check
|
|
||||||
pmb.helpers.other.check_grsec(args)
|
|
||||||
|
|
||||||
# Initialize or require config
|
|
||||||
if args.action == "init":
|
|
||||||
return pmb.config.init(args)
|
|
||||||
elif not os.path.exists(args.config):
|
|
||||||
logging.critical("Please specify a config file, or run"
|
|
||||||
" 'pmbootstrap init' to generate one.")
|
|
||||||
return 1
|
|
||||||
|
|
||||||
# Run the function with the action's name (in pmb/helpers/frontend.py)
|
|
||||||
if args.action:
|
|
||||||
getattr(pmb.helpers.frontend, args.action)(args)
|
|
||||||
else:
|
|
||||||
logging.info("Run pmbootstrap -h for usage information.")
|
|
||||||
|
|
||||||
# Print finish timestamp
|
|
||||||
logging.info("Done")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logging.info("ERROR: " + str(e))
|
|
||||||
logging.info("Run 'pmbootstrap log' for details.")
|
|
||||||
logging.info("See also: <https://postmarketos.org/troubleshooting>")
|
|
||||||
logging.debug(traceback.format_exc())
|
|
||||||
return 1
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(pmb.main())
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import re
|
||||||
|
import ast
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from setuptools import setup, find_packages
|
||||||
|
from setuptools.command.test import test as TestCommand
|
||||||
|
|
||||||
|
from codecs import open
|
||||||
|
from os import path
|
||||||
|
|
||||||
|
|
||||||
|
class PyTest(TestCommand):
|
||||||
|
user_options = [('pytest-args=', 'a', 'Arguments to pass to pytest')]
|
||||||
|
|
||||||
|
def initialize_options(self):
|
||||||
|
TestCommand.initialize_options(self)
|
||||||
|
self.pytest_args = ''
|
||||||
|
|
||||||
|
def run_tests(self):
|
||||||
|
import shlex
|
||||||
|
import pytest
|
||||||
|
errno = pytest.main(shlex.split(self.pytest_args))
|
||||||
|
sys.exit(errno)
|
||||||
|
|
||||||
|
|
||||||
|
here = path.abspath(path.dirname(__file__))
|
||||||
|
_version_re = re.compile(r'version\s+=\s+(.*)')
|
||||||
|
|
||||||
|
with open(path.join(here, 'pmb/config/__init__.py'), 'rb') as f:
|
||||||
|
version = str(ast.literal_eval(_version_re.search(f.read().decode('utf-8')).group(1)))
|
||||||
|
|
||||||
|
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
|
||||||
|
long_description = f.read()
|
||||||
|
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name='pmbootstrap',
|
||||||
|
version=version,
|
||||||
|
description='A sophisticated chroot / build / flash tool to develop and install postmarketOS',
|
||||||
|
long_description=long_description,
|
||||||
|
author='postmarketOS Developers',
|
||||||
|
author_email='info@postmarketos.org',
|
||||||
|
url='https://www.postmarketos.org',
|
||||||
|
license='GPLv3',
|
||||||
|
python_requires='>=3.4',
|
||||||
|
classifiers=[
|
||||||
|
'Development Status :: 3 - Alpha',
|
||||||
|
'Intended Audience :: Developers',
|
||||||
|
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
|
||||||
|
'Programming Language :: Python :: 3',
|
||||||
|
'Programming Language :: Python :: 3.4',
|
||||||
|
'Programming Language :: Python :: 3.5',
|
||||||
|
'Programming Language :: Python :: 3.6',
|
||||||
|
],
|
||||||
|
keywords='postmarketos pmbootstrap',
|
||||||
|
packages=find_packages(exclude=['aports', 'keys', 'test']),
|
||||||
|
tests_require=['pytest'],
|
||||||
|
cmdclass={'test': PyTest},
|
||||||
|
entry_points={
|
||||||
|
'console_scripts': [
|
||||||
|
'pmbootstrap=pmb:main',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
)
|
Loading…
Reference in New Issue