05.11., 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 2ba711a5 authored by Eckhart Arnold's avatar Eckhart Arnold

- repair cython compatibility

parent f5bdaf59
// json-example
{
"object": { "one": 1, "two": 2, "three": ["3"] },
"object":
{
"one": 1,
"two": 2,
"three": ["3"]
},
"array": ["one", 2, 3],
"string": "string example",
"true": true,
......
......@@ -69,27 +69,32 @@ def rename_projectdir(path: str, new: str) -> bool:
os.chdir(save)
def rename_project(projectdir: str, new_name: str) -> str:
"""Renames a project. Returns an error string in case of failure
or the empty string if successful."""
if not os.path.isdir(projectdir):
return projectdir + " is not a directory!"
elif check_projectdir(projectdir):
m = re.match('\w+', new_name)
if m and len(m.group(0)) == len(new_name):
if save_project(projectdir):
rename_projectdir(projectdir, new_name)
else:
return 'Could not save old project to ' + os.path.basename(projectdir) + '_saved!'
else:
return new_name + " is not a valid project name!"
else:
return projectdir + " does not seem to be a DHParser-project directory!"
return ''
if __name__ == "__main__":
if len(sys.argv) == 3:
projectdir = sys.argv[1]
new_name = sys.argv[2]
if not os.path.isdir(projectdir):
print(projectdir + " is not a directory!")
sys.exit(1)
elif check_projectdir(projectdir):
m = re.match('\w+', new_name)
if m and len(m.group(0)) == len(new_name):
if save_project(projectdir):
rename_projectdir(projectdir, new_name)
else:
print('Could not save old project to '
+ os.path.basename(projectdir) + '_saved!')
sys.exit(1)
else:
print(new_name + " is not a valid project name!")
sys.exit(1)
else:
print(projectdir + " does not seem to be a DHParser-project directory!")
error = rename_project(projectdir, new_name)
if error:
print(error)
sys.exit(1)
else:
print('Usage: python rename_project.py PROJECT_DIRECTORY NEW_NAME')
......@@ -53,7 +53,7 @@ setup(
scripts=['scripts/dhparser.py'],
entry_points={
'console_scripts': [
'dhparser=scripts.dhparser:main'
'dhparser=dhparser:main'
]
}
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment