Move script to package.
This commit is contained in:
parent
01abe88930
commit
c7fcd22b9f
3 changed files with 42 additions and 24 deletions
|
@ -239,26 +239,3 @@ class PlainSession(object):
|
|||
def Popen(self, args, stdout=None, stderr=None, user=None, cwd=None):
|
||||
return subprocess.Popen(
|
||||
args, stdout=stdout, stderr=stderr, cwd=cwd)
|
||||
|
||||
|
||||
def main(argv):
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('subcommand', type=str, choices=['dist'])
|
||||
parser.add_argument(
|
||||
'--directory', '-d', type=str, help='Directory for project.',
|
||||
default='.')
|
||||
args = parser.parse_args()
|
||||
session = PlainSession()
|
||||
os.chdir(args.directory)
|
||||
try:
|
||||
if args.subcommand == 'dist':
|
||||
run_dist(session)
|
||||
except NoBuildToolsFound:
|
||||
note('No build tools found.')
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
41
ognibuild/__main__.py
Normal file
41
ognibuild/__main__.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
# Copyright (C) 2019-2020 Jelmer Vernooij <jelmer@jelmer.uk>
|
||||
# encoding: utf-8
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
import os
|
||||
import sys
|
||||
from . import PlainSession, run_dist, NoBuildToolsFound, note
|
||||
|
||||
|
||||
def main():
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('subcommand', type=str, choices=['dist'])
|
||||
parser.add_argument(
|
||||
'--directory', '-d', type=str, help='Directory for project.',
|
||||
default='.')
|
||||
args = parser.parse_args()
|
||||
session = PlainSession()
|
||||
os.chdir(args.directory)
|
||||
try:
|
||||
if args.subcommand == 'dist':
|
||||
run_dist(session)
|
||||
except NoBuildToolsFound:
|
||||
note('No build tools found.')
|
||||
return 1
|
||||
return 0
|
||||
|
||||
sys.exit(main())
|
2
setup.py
2
setup.py
|
@ -11,7 +11,7 @@ setup(name="ognibuild",
|
|||
maintainer_email="jelmer@jelmer.uk",
|
||||
license="GNU GPLv2 or later",
|
||||
url="https://jelmer.uk/code/ognibuild",
|
||||
scripts=['ognibuild.py'],
|
||||
packages=['ognibuild'],
|
||||
classifiers=[
|
||||
'Development Status :: 4 - Beta',
|
||||
'License :: OSI Approved :: '
|
||||
|
|
Loading…
Add table
Reference in a new issue