Skip to content

Commit

Permalink
Resolve: 23 clean up project structure (#40)
Browse files Browse the repository at this point in the history
* Clean up project structure: unified script taking all input formats

re #23

* Intermediate commit

re #23

* Intermediate commit

re #23

* Intermediate commit

re #23

* Intermediate commit

re #23

* Intermediate commit

re #23

* Windows fixes

re #23

* Cleanup including os.path replacement with pathlib where possible

re #23

* Removing obsolete unit test classes

re #23

* Bugfixes for Risc5

re #23

* Small fixes

re #23

* Further fixes and initial unit tests

re #23

* Revived existing unit tests

re #23

* More unit tests

re #23

* More unit tests

re #23

* More unit tests

re #23

* More unit tests + small fixes

re #23

* Rename class ArgsAndFileParser to ProjectOptions

re #23

* ProjectOptions unit tests + related fixes

re #23

* Class renaming + converting ConverterHelper to class + fixing unit test fallout

re #23

* Fix toplevel script

re #23

* Fix top level script

re #23

* Another round of toplevel cleanup
re #23

* Integrated suggestions from review (partim)

re #23

* Make separate subclasses per project layout in ProjectCreator

re #23

* re #23

* Review feedback round 2 part 1

re #23

* Register project creators (not OK)

re #23

* Register project creators (fixed)

re #23

* Improve project file parser setup

re #23

* Integration of review suggestions

re #23

---------

Co-authored-by: Wim Meeus <[email protected]>
  • Loading branch information
wmeeus and Wim Meeus authored Nov 9, 2023
1 parent 325c861 commit 81102b5
Show file tree
Hide file tree
Showing 41 changed files with 1,898 additions and 968 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pytest-cov>=2.6.1
pytest-xdist>=1.25.0
coveralls>=1.5.1
antlr4-python3-runtime>=4.9.1
dataclasses
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
setup(name="SigasiProjectCreator",
description="Generate a Sigasi Project from your own project specifications",
url='https://github.com/sigasi/SigasiProjectCreator',
packages=['SigasiProjectCreator'],
package_dir={'': 'src'},
)
63 changes: 0 additions & 63 deletions src/SigasiProjectCreator/ArgsAndFileParser.py

This file was deleted.

152 changes: 0 additions & 152 deletions src/SigasiProjectCreator/ConverterHelper.py

This file was deleted.

37 changes: 23 additions & 14 deletions src/SigasiProjectCreator/CsvParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,30 @@
:license: BSD, see LICENSE for more details.
"""
import csv
import pathlib

usage = """usage: %prog project-name csv-file [destination]
from SigasiProjectCreator.ProjectFileParser import ProjectFileParser, project_file_parser, ProjectFileParserResult

destination is the current directory by default
example: %prog MyProjectName filelist.csv
"""

@project_file_parser('csv')
class CsvParser(ProjectFileParser):
"""CSV file"""
def __init__(self):
super().__init__()

def parse_file(csv_file):
entries = dict()
with open(csv_file, 'r') as f:
reader = csv.reader(f, skipinitialspace=True)
for row in reader:
if row:
library = row[0].strip()
path = row[1].strip()
entries[path] = library
return entries
def parse_file(self, csv_file, options=None):
library_mapping = dict()
with open(csv_file, 'r') as f:
reader = csv.reader(f, skipinitialspace=True)
for row in reader:
if row:
library = row[0].strip()
path = pathlib.Path(row[1].strip()).absolute().resolve()
if path in library_mapping:
if isinstance(library_mapping[path], list):
library_mapping[path].append(library)
else:
library_mapping[path] = [library_mapping[path], library]
else:
library_mapping[path] = library
return ProjectFileParserResult(library_mapping, None, None)
4 changes: 2 additions & 2 deletions src/SigasiProjectCreator/DotF/DotFLexer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated from DotF.g4 by ANTLR 4.13.0
# Generated from DotF.g4 by ANTLR 4.13.1
from antlr4 import *
from io import StringIO
import sys
Expand Down Expand Up @@ -100,7 +100,7 @@ class DotFLexer(Lexer):

def __init__(self, input=None, output:TextIO = sys.stdout):
super().__init__(input, output)
self.checkVersion("4.13.0")
self.checkVersion("4.13.1")
self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache())
self._actions = None
self._predicates = None
Expand Down
2 changes: 1 addition & 1 deletion src/SigasiProjectCreator/DotF/DotFListener.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated from DotF.g4 by ANTLR 4.13.0
# Generated from DotF.g4 by ANTLR 4.13.1
from antlr4 import *
if "." in __name__:
from .DotFParser import DotFParser
Expand Down
4 changes: 2 additions & 2 deletions src/SigasiProjectCreator/DotF/DotFParser.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated from DotF.g4 by ANTLR 4.13.0
# Generated from DotF.g4 by ANTLR 4.13.1
# encoding: utf-8
from antlr4 import *
from io import StringIO
Expand Down Expand Up @@ -74,7 +74,7 @@ class DotFParser ( Parser ):

def __init__(self, input:TokenStream, output:TextIO = sys.stdout):
super().__init__(input, output)
self.checkVersion("4.13.0")
self.checkVersion("4.13.1")
self._interp = ParserATNSimulator(self, self.atn, self.decisionsToDFA, self.sharedContextCache)
self._predicates = None

Expand Down
Loading

0 comments on commit 81102b5

Please sign in to comment.