Skip to content
Snippets Groups Projects

Feature/install script generator

Merged Dennis Gläser requested to merge feature/install-script-generator into master
Compare and Show latest version
3 files
+ 58
27
Compare changes
  • Side-by-side
  • Inline
Files
3
import os
import subprocess
# function to determine module name from module file
def getModuleName(modulePath):
# function to get the info related to the given key in a module file
def getModuleInfo(modulePath, key):
modFile = os.path.join(modulePath, 'dune.module')
if not os.path.exists(modFile):
return None
raise RuntimeError("Could not find module file")
with open(modFile, 'r') as modFile:
for line in modFile.readlines():
line = line.strip('\n').split(' ')
if line[0] == 'Module:':
return line[1]
return None
line = line.strip('\n').split(':')
if line[0] == key:
return line[1].strip()
raise RuntimeError("Could not extract requested information")
# function to determine module name from module file
def getModuleName(modulePath):
return getModuleInfo(modulePath, "Module")
# get the dependencies of a dune module located in the given directory
def getDependencies(modulePath):
Loading