File: updateBuilderDemos.py

package info (click to toggle)
psychopy 2020.2.10%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 44,056 kB
  • sloc: python: 119,649; javascript: 3,022; makefile: 148; sh: 125; xml: 9
file content (25 lines) | stat: -rw-r--r-- 868 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# this script replaces hashtags with a sphinx URL string (to the github issues or pull request)
# written by Jon with regex code by Jeremy

from __future__ import absolute_import, print_function
import os
from psychopy import experiment, __version__
from pathlib import Path

thisFolder = Path(__file__).parent

nFiles = 0
for root, dirs, files in os.walk(thisFolder.parent/"psychopy/demos/builder"):
    for filename in files:
        if filename.endswith('.psyexp'):

            filepath = os.path.join(root, filename)
            exp = experiment.Experiment()
            exp.loadFromXML(filepath)
            origVersion = exp.psychopyVersion
            exp.psychopyVersion = __version__
            exp.saveToXML(filepath)
            print("switching {} from {} to {}".format(filepath, origVersion, __version__))