Move code into a src directory, so it doesn't get accidentally imported.

main
Ben Niemann 2021-10-26 19:45:34 +02:00
parent 3b28d053b7
commit 55eca35776
42 changed files with 44 additions and 2 deletions

View File

@ -2,6 +2,7 @@
; Projetile
(projectile-project-test-cmd . "nix-shell --run './waf test'")
(projectile-project-compilation-cmd . "nix-shell --run './waf build'")
(projectile-project-run-cmd . "nix-shell --run './run-noisicaa'")
(pyvenv-workon . "noisicaa")

6
run-noisicaa Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
set -e
./waf build
export PYTHONPATH="$(dirname "$0")/build"
exec python -m noisicaa.main "$@"

View File

@ -35,6 +35,8 @@ class Main(object):
self.parse_args(argv)
print(__file__)
print("path:")
print('- ' + '\n- '.join(sorted(sys.path)))
return 0
# with logging.LogManager(self.runtime_settings) as log_manager:

22
src/wscript Normal file
View File

@ -0,0 +1,22 @@
# @begin:license
#
# Copyright (c) 2015-2021, Ben Niemann <pink@odahoda.de>
#
# 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.
#
# @end:license
def build(ctx):
ctx.recurse('noisicaa')

15
wscript
View File

@ -20,6 +20,7 @@
import contextlib
import fnmatch
import logging
import os.path
import subprocess
from waflib.Build import BuildContext
@ -28,7 +29,17 @@ from waflib.Errors import BuildError, ConfigurationError
from waflib import Logs
from waflib import Utils
top = '.'
def filter_log_spam(rec):
# Waf emits this, because we set top to a subdir of the root dir. I couldn't find any
# information why this might be a bad idea, apart from the existance of this warning. It does
# yield the right behaviour ('src' in not added to the paths in the build directory), so let's
# just remove this warning.
if rec.msg.startswith('Are you certain that you do not want to set top="."'):
return False
return True
logging.getLogger('waflib').addFilter(filter_log_spam)
top = 'src'
out = 'build'
# Properly format command lines when using -v
@ -202,7 +213,7 @@ def build(ctx):
ctx.set_group(ctx.GRP_BUILD_MAIN)
ctx(rule='touch ${TGT}', target='.nobackup')
ctx.recurse('noisicaa')
ctx.recurse('src')
if ctx.cmd == 'test':
ctx.add_pre_fun(clear_coverage_data)