Skip to content

Commit

Permalink
Initial import 0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mementum committed Jan 26, 2016
0 parents commit d219e1e
Show file tree
Hide file tree
Showing 37 changed files with 6,241 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
binaries.*/

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Backups
*.bak
*~
.#*
*#
*.swp
*.swo
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions LICENSE-3rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
3rd Party Licenses

======================================================================
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fritzchecksum
=============

Quick and dirty utility to calculate the CRC of a modified Fritz!Box
configuration file and write it to a new file which can the be loaded to the
router
120 changes: 120 additions & 0 deletions scripts/build_exe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2014 Daniel Rodriguez
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
#
###############################################################################
import argparse
import logging
import subprocess
import sys

logging.basicConfig(
format='%(levelname)s: %(message)s',
level=logging.INFO)

if True: # to avoid PEP-8 complaints
import build_utils

##################################################
# CONSTANTS FOR SPEC GENERATION
##################################################
# pyinstaller can generate spec and executable in one step
# specs_cmd = ['pyinstaller', '--noconfirm', '--windowed', '--noupx']

# Base command for spec generation
# --noconfirm is not accepted by pyi-makespec
specs_cmd = ['pyi-makespec', '--noupx']

# Base command for executable generation
pyinst_cmd = ['pyinstaller', '--noconfirm']

if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Prepare spec file and generate executable')
parser.add_argument('--clean', action='store_true',
help='tell pyinstaller to clean up the build cache')

group = parser.add_mutually_exclusive_group()

group.add_argument('--console', required=False, action='store_true',
help='Build the console application if present')

group.add_argument('--gui', required=False, action='store_true',
help='Build the gui application if present')

args = parser.parse_args()

# Decide whether we are building console or gui
gui = args.gui or not args.console

logging.info('Creating Application Information Object')
try:
appinfo = build_utils.AppInfo(gui=gui)
except Exception, e:
logging.error('Failed to initialize AppInfo')
logging.error(str(e))
sys.exit(1)

logging.info('Getting Spec file')
specfile = appinfo.getspecfile()
if not specfile:
logging.error('Specfile was not found. Check for presence')
sys.exit(1)

logging.info('Begin operations')
logging.info('Cleaning up backups')
try:
appinfo.clean_srcdir_backups()
except OSError, e:
logging.error('Failed to remove all backups')
logging.error(str(e))
sys.exit(1)

logging.info('Cleaning up compiled pythons')
try:
appinfo.clean_srcdir_pyc()
except OSError, e:
logging.error('Failed to remove all compiled python files')
logging.error(str(e))
sys.exit(1)

logging.info(('Making (deleting if needed) previous executable'
' generation directories'))
try:
appinfo.make_dirs_exe()
except OSError, e:
logging.error('Directory operation failed')
logging.error(str(e))
sys.exit(1)

if args.clean:
logging.info('Adding --clean to command line arguments')
pyinst_cmd.append('--clean')

logging.info('Adding work directory to command line arguments')
pyinst_cmd.append('--workpath=' + appinfo.dirs['exe_build'])
logging.info('Adding distribution directory to command line arguments')
pyinst_cmd.append('--distpath=' + appinfo.dirs['exe_dist'])
logging.info('Adding specfile to command line arguments')
pyinst_cmd.append(specfile)

logging.info('Generating executable with command: %s' %
' '.join(pyinst_cmd))
subprocess.call(pyinst_cmd)

logging.info('End of operations')
99 changes: 99 additions & 0 deletions scripts/build_setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2014 Daniel Rodriguez
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
#
###############################################################################
import argparse
import logging
import subprocess
import sys

logging.basicConfig(
format='%(levelname)s: %(message)s',
level=logging.INFO)

import build_utils

iscc_cmd = ['iscc']


if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Prepare iss file and build setup file')
parser.add_argument('--iss',
action='store_true',
help='do only prepare the iss file')
args = parser.parse_args()

logging.info('Creating Application Information Object')
try:
appinfo = build_utils.AppInfo()
except Exception, e:
logging.error('Failed to initialize AppInfo')
logging.error(str(e))
sys.exit(1)

logging.info('Checking AppId')
retval, uuid = appinfo.validappid()
if not retval:
logging.error(('The application has not yet defined an Application'
' UUID and the setup cannot be generated'))
logging.error('Please add AppId="%s" to your appconstants file', uuid)
sys.exit(1)

logging.info('Getting the InnoSetup file')
issfile = appinfo.getissfile()
if not issfile:
logging.error('iss file was not found. Check for presence')
sys.exit(1)

logging.info('Adjusting values in iss file')
try:
appinfo.prepare_issfile()
except Exception, e:
logging.error('Operation failed')
logging.error(str(e))
sys.exit(1)

if args.iss:
logging.info('Generated iss file. Setup build not requested. Exiting')
sys.exit(0)

logging.info('Checking executable distribution directories')
if not appinfo.check_dirs_exe_dist():
logging.error('Failed to find executable distribution dir. Exiting')
sys.exit(1)

logging.info('Creating (deleting if needed) the directories for setup')
try:
appinfo.make_dirs_setup()
except OSError, e:
logging.error('Directory operation failed')
logging.error(str(e))
sys.exit(1)

logging.info('Copying distributable files from exec distribution dir')
appinfo.copy_exedist_to_setupbuild()

logging.info('Appending issfile %s to command line arguments to iscc' %
issfile)
iscc_cmd.append(issfile)
logging.info('Generating executable with command: %s' % ' '.join(iscc_cmd))
subprocess.call(iscc_cmd)

logging.info('End of operations')
Loading

0 comments on commit d219e1e

Please sign in to comment.