Skip to content

Commit

Permalink
Fix project.ext.python
Browse files Browse the repository at this point in the history
  • Loading branch information
yorevs committed Oct 3, 2024
1 parent 9d60ede commit 96c42ae
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 54 deletions.
29 changes: 26 additions & 3 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,33 @@
*/
import org.gradle.internal.os.OperatingSystem;

String detectPython() {
def pythonHome = System.getenv('PYTHON_HOME') ?: null
if (pythonHome != null) {
return pythonHome + '/python3'
}

def output = new ByteArrayOutputStream()
exec {
commandLine 'bash', '-c', 'command -v python3'
standardOutput = output
}

pythonHome = output.toString().trim()
assert pythonHome != null && !pythonHome.isEmpty(), "Could not find any installed python3 version"

return pythonHome
}


/* Project file definitions */
project.ext.depsFile = "$project.projectDir/dependencies.hspd"
project.ext.reqsFile = "$project.projectDir/src/main/requirements.txt"
project.ext.os = OperatingSystem.current().getName()
ext {
depsFile = "$project.projectDir/dependencies.hspd"
reqsFile = "$project.projectDir/src/main/requirements.txt"
os = OperatingSystem.current().getName()
python = detectPython()
pyrcc = 'pyrcc5'
}

/* Version compatibility mode map */
def modesMap = [
Expand Down
2 changes: 1 addition & 1 deletion gradle/python.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ task compileQrc(type: Task) {
}.each { File file ->
if (verbose) println "Compiling Qt Resource -> ${file.name}"
exec {
commandLine project.pyrcc, '-m', 'py_compile', file.path
commandLine project.pyrcc, file.path
}
}
}
Expand Down
47 changes: 0 additions & 47 deletions src/main/requirements.txt

This file was deleted.

3 changes: 2 additions & 1 deletion src/test/resources/application-test.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Main test application property file
# Main test application property file
any.property=12345
4 changes: 2 additions & 2 deletions src/test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
class TestMain(unittest.TestCase):
# Setup tests
def setUp(self):
resource_dir = "{}/resources".format(TEST_DIR)
resource_dir = f"{TEST_DIR}/resources"
os.environ["ACTIVE_PROFILE"] = "test"
self.configs = AppConfigs(resource_dir=resource_dir)
self.assertIsNotNone(self.configs)
self.assertIsNotNone(AppConfigs.INSTANCE)
self.assertEqual(self.configs.get_int('any.property'), 12345)
log.info(self.configs)

# Teardown tests
Expand Down

0 comments on commit 96c42ae

Please sign in to comment.