pyreqif 0.7__tar.gz → 0.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyreqif-0.9/.gitattributes +0 -0
- pyreqif-0.9/.github/workflows/ci.yml +26 -0
- pyreqif-0.9/.github/workflows/release.yml +56 -0
- pyreqif-0.9/.gitignore +6 -0
- pyreqif-0.9/LICENSE +25 -0
- pyreqif-0.9/PKG-INFO +50 -0
- {pyreqif-0.7 → pyreqif-0.9}/README.md +6 -3
- pyreqif-0.9/createReqDoc.py +40 -0
- pyreqif-0.9/example.py +73 -0
- pyreqif-0.9/pyproject.toml +40 -0
- pyreqif-0.9/rif2reqif.py +14 -0
- pyreqif-0.9/setup.cfg +4 -0
- pyreqif-0.9/src/pyreqif/__init__.py +9 -0
- pyreqif-0.9/src/pyreqif/create.py +93 -0
- {pyreqif-0.7 → pyreqif-0.9}/src/pyreqif/html.py +8 -6
- {pyreqif-0.7 → pyreqif-0.9}/src/pyreqif/pyreqif.py +95 -72
- {pyreqif-0.7 → pyreqif-0.9}/src/pyreqif/reqif.py +110 -105
- {pyreqif-0.7 → pyreqif-0.9}/src/pyreqif/rif.py +239 -200
- {pyreqif-0.7 → pyreqif-0.9}/src/pyreqif/xlsx.py +27 -1
- pyreqif-0.9/src/pyreqif.egg-info/PKG-INFO +50 -0
- {pyreqif-0.7 → pyreqif-0.9}/src/pyreqif.egg-info/SOURCES.txt +12 -5
- {pyreqif-0.7 → pyreqif-0.9}/src/pyreqif.egg-info/requires.txt +3 -2
- pyreqif-0.9/src/pyreqif.egg-info/scm_file_list.json +27 -0
- pyreqif-0.9/src/pyreqif.egg-info/scm_version.json +8 -0
- pyreqif-0.9/test.sh +14 -0
- pyreqif-0.9/xlsx2reqif.py +236 -0
- pyreqif-0.7/MANIFEST.in +0 -2
- pyreqif-0.7/PKG-INFO +0 -29
- pyreqif-0.7/setup.cfg +0 -11
- pyreqif-0.7/setup.py +0 -51
- pyreqif-0.7/src/pyreqif/__init__.py +0 -4
- pyreqif-0.7/src/pyreqif/_version.py +0 -21
- pyreqif-0.7/src/pyreqif/create.py +0 -61
- pyreqif-0.7/src/pyreqif.egg-info/PKG-INFO +0 -29
- pyreqif-0.7/versioneer.py +0 -1822
- pyreqif-0.7/xlsx2reqif.py +0 -154
- {pyreqif-0.7 → pyreqif-0.9}/reqif2html.py +0 -0
- {pyreqif-0.7 → pyreqif-0.9}/reqif2xlsx.py +0 -0
- {pyreqif-0.7 → pyreqif-0.9}/src/pyreqif/extractOleData.py +0 -0
- {pyreqif-0.7 → pyreqif-0.9}/src/pyreqif/ole2rtf.py +0 -0
- {pyreqif-0.7 → pyreqif-0.9}/src/pyreqif.egg-info/dependency_links.txt +0 -0
- {pyreqif-0.7 → pyreqif-0.9}/src/pyreqif.egg-info/top_level.txt +0 -0
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
test:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
strategy:
|
|
11
|
+
fail-fast: false
|
|
12
|
+
matrix:
|
|
13
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0 # setuptools_scm needs the full history for the version
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ matrix.python-version }}
|
|
21
|
+
- name: Install
|
|
22
|
+
run: |
|
|
23
|
+
python -m pip install --upgrade pip
|
|
24
|
+
pip install -e .
|
|
25
|
+
- name: Roundtrip test
|
|
26
|
+
run: bash test.sh
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "0.*"
|
|
7
|
+
- "1.*"
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
with:
|
|
15
|
+
fetch-depth: 0 # setuptools_scm needs the full history for the version
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
- name: Build sdist and wheel
|
|
20
|
+
run: |
|
|
21
|
+
python -m pip install --upgrade pip build
|
|
22
|
+
python -m build
|
|
23
|
+
- uses: actions/upload-artifact@v4
|
|
24
|
+
with:
|
|
25
|
+
name: dist
|
|
26
|
+
path: dist/
|
|
27
|
+
|
|
28
|
+
github-release:
|
|
29
|
+
needs: build
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
permissions:
|
|
32
|
+
contents: write
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/download-artifact@v4
|
|
35
|
+
with:
|
|
36
|
+
name: dist
|
|
37
|
+
path: dist/
|
|
38
|
+
- name: Create GitHub release
|
|
39
|
+
uses: softprops/action-gh-release@v2
|
|
40
|
+
with:
|
|
41
|
+
files: dist/*
|
|
42
|
+
generate_release_notes: true
|
|
43
|
+
|
|
44
|
+
pypi-publish:
|
|
45
|
+
name: Publish to PyPI
|
|
46
|
+
needs: build
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
permissions:
|
|
49
|
+
id-token: write # trusted publishing (OIDC)
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/download-artifact@v4
|
|
52
|
+
with:
|
|
53
|
+
name: dist
|
|
54
|
+
path: dist/
|
|
55
|
+
- name: Publish to PyPI
|
|
56
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
pyreqif-0.9/.gitignore
ADDED
pyreqif-0.9/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
BSD 2-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017, Eduard Bröcker
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
17
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
18
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
20
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
21
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
22
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
23
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
24
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
25
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
pyreqif-0.9/PKG-INFO
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyreqif
|
|
3
|
+
Version: 0.9
|
|
4
|
+
Summary: very basic python implementation of reqif object model with import and export feature
|
|
5
|
+
Author-email: Eduard Broecker <eduard@gmx.de>
|
|
6
|
+
License: BSD
|
|
7
|
+
Project-URL: Homepage, https://github.com/ebroecker/pyreqif
|
|
8
|
+
Keywords: reqif,requirements,interchange,format
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: lxml
|
|
18
|
+
Requires-Dist: oletools
|
|
19
|
+
Requires-Dist: openpyxl
|
|
20
|
+
Requires-Dist: pillow
|
|
21
|
+
Requires-Dist: xlsxwriter
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# pyreqif
|
|
25
|
+
|
|
26
|
+
[](https://github.com/ebroecker/pyreqif/actions/workflows/ci.yml)
|
|
27
|
+
|
|
28
|
+
## simple python representation of RIF/REQIF (Exerpt/HIS/...) Objects in Python ##
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
currently some basic support to convert:
|
|
32
|
+
* reqif2html.py:
|
|
33
|
+
converts given rif/reqif-File to html-File
|
|
34
|
+
* reqif2xlsx.py
|
|
35
|
+
converts given rif/reqif-File to xlsx-File (Excel)
|
|
36
|
+
* xlsx2reqif.py
|
|
37
|
+
converts given xlsx-File (Excel) to rif/reqif-File
|
|
38
|
+
* example.py
|
|
39
|
+
use for own implementations (e.g. for import reqif-objects in own system)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Howto Install ##
|
|
43
|
+
* from PyPI (after next release): `pip install pyreqif`
|
|
44
|
+
* from source:
|
|
45
|
+
* git clone https://github.com/ebroecker/pyreqif.git
|
|
46
|
+
* `pip install .` (or `pip install -e .` for development)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pyreqif
|
|
2
2
|
|
|
3
|
-
[](https://github.com/ebroecker/pyreqif/actions/workflows/ci.yml)
|
|
4
4
|
|
|
5
5
|
## simple python representation of RIF/REQIF (Exerpt/HIS/...) Objects in Python ##
|
|
6
6
|
|
|
@@ -17,8 +17,11 @@ currently some basic support to convert:
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
## Howto Install ##
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* from PyPI (after next release): `pip install pyreqif`
|
|
21
|
+
* from source:
|
|
22
|
+
* git clone https://github.com/ebroecker/pyreqif.git
|
|
23
|
+
* `pip install .` (or `pip install -e .` for development)
|
|
24
|
+
|
|
22
25
|
|
|
23
26
|
|
|
24
27
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
from __future__ import absolute_import
|
|
3
|
+
|
|
4
|
+
import pyreqif.pyreqif
|
|
5
|
+
import pyreqif.reqif
|
|
6
|
+
import pyreqif.create
|
|
7
|
+
|
|
8
|
+
xhtmlDatatypeId = "_2"
|
|
9
|
+
reqirementTypeId = "_3"
|
|
10
|
+
collumn1typeId = "_4"
|
|
11
|
+
collumn2typeId = "_5"
|
|
12
|
+
|
|
13
|
+
document_id = "_1"
|
|
14
|
+
doc_type_ref = "_doc_type_ref"
|
|
15
|
+
|
|
16
|
+
mydoc = pyreqif.create.createDocument(document_id)
|
|
17
|
+
pyreqif.create.addDocType(doc_type_ref, mydoc)
|
|
18
|
+
pyreqif.create.addDatatype(xhtmlDatatypeId, mydoc)
|
|
19
|
+
|
|
20
|
+
pyreqif.create.addReqType(reqirementTypeId, "requirement Type", collumn1typeId, "Col1", xhtmlDatatypeId, mydoc)
|
|
21
|
+
pyreqif.create.addReqType(reqirementTypeId, "", collumn2typeId, "Col2", xhtmlDatatypeId, mydoc)
|
|
22
|
+
|
|
23
|
+
pyreqif.create.addReq("_6", reqirementTypeId, "<div>Hallo</div>", collumn1typeId, mydoc)
|
|
24
|
+
pyreqif.create.addReq("_6", reqirementTypeId, "<div>Hallo2</div>", collumn2typeId, mydoc)
|
|
25
|
+
|
|
26
|
+
pyreqif.create.addReq("_7", reqirementTypeId, "<div>Hallo 3</div>", collumn1typeId, mydoc)
|
|
27
|
+
pyreqif.create.addReq("_7", reqirementTypeId, "<div>Hallo 4</div>", collumn2typeId, mydoc)
|
|
28
|
+
|
|
29
|
+
link_type = document_id + "link_type"
|
|
30
|
+
pyreqif.create.addRelation("_6", "_7", mydoc, id="_self_link", type=link_type)
|
|
31
|
+
pyreqif.create.addSpecRelationType(link_type, mydoc, longName="selflink")
|
|
32
|
+
|
|
33
|
+
myHierarch = pyreqif.create.createHierarchHead("Reqirement Document Name", typeRef=doc_type_ref)
|
|
34
|
+
myHierarch.addChild(pyreqif.create.createHierarchElement("_6"))
|
|
35
|
+
myHierarch.addChild(pyreqif.create.createHierarchElement("_7"))
|
|
36
|
+
|
|
37
|
+
mydoc.hierarchy.append(myHierarch)
|
|
38
|
+
|
|
39
|
+
f = open("aa.reqif", "w")
|
|
40
|
+
pyreqif.reqif.dump(mydoc, f)
|
pyreqif-0.9/example.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
from __future__ import print_function
|
|
3
|
+
import os.path
|
|
4
|
+
import pyreqif.reqif
|
|
5
|
+
import pyreqif.rif
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
#
|
|
9
|
+
# command line parsing
|
|
10
|
+
#
|
|
11
|
+
if len(sys.argv) < 2:
|
|
12
|
+
print("Usage {} some_reqif_file.reqif\n".format(sys.argv[0]))
|
|
13
|
+
print("prints Text and Chapter Information and also exports a RIF file")
|
|
14
|
+
sys.exit()
|
|
15
|
+
|
|
16
|
+
filename = sys.argv[1]
|
|
17
|
+
|
|
18
|
+
#
|
|
19
|
+
# calculate base path of reqif-document for extracting attachments
|
|
20
|
+
#
|
|
21
|
+
basepath = os.path.dirname(filename)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
#
|
|
25
|
+
# load reqif/rif file
|
|
26
|
+
#
|
|
27
|
+
myDoc = pyreqif.reqif.load(filename)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
#
|
|
31
|
+
# example rif export:
|
|
32
|
+
#
|
|
33
|
+
f = open(os.path.splitext(filename)[0] + "_pyreqif_export.xml", "wb")
|
|
34
|
+
pyreqif.rif.dump(myDoc,f)
|
|
35
|
+
|
|
36
|
+
#
|
|
37
|
+
# example ascii console 'flat' dump, without hierarchie
|
|
38
|
+
#
|
|
39
|
+
print ("Specification Requirements (flat):")
|
|
40
|
+
specs = myDoc.asDict()
|
|
41
|
+
for spec in specs:
|
|
42
|
+
for req in spec:
|
|
43
|
+
for key,value in req.items():
|
|
44
|
+
print ("{} : {}".format(key, value), end=" ")
|
|
45
|
+
print("")
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
#
|
|
49
|
+
# example ascii console 'hierarchy' dump, using hierach_iterator
|
|
50
|
+
#
|
|
51
|
+
print ("Specification Requirements (hierarchical):")
|
|
52
|
+
cols = myDoc.fields
|
|
53
|
+
for spec in specs:
|
|
54
|
+
for child in myDoc.hierarchy:
|
|
55
|
+
for item, depth in myDoc.hierach_iterator(child, cols):
|
|
56
|
+
#
|
|
57
|
+
# iterator gives every element and its hierachical depth
|
|
58
|
+
# do some ascii printing of Text and Chapter
|
|
59
|
+
print(" " * depth, end="")
|
|
60
|
+
for key, value in req.items():
|
|
61
|
+
print("{} : {}".format(key, value), end=" ")
|
|
62
|
+
print("")
|
|
63
|
+
# print (item["ReqIF.ChapterName"], end="")
|
|
64
|
+
# print (item["ReqIF.Text"])
|
|
65
|
+
|
|
66
|
+
#
|
|
67
|
+
# print some info, if attachement is found
|
|
68
|
+
#
|
|
69
|
+
if "attachments" in item:
|
|
70
|
+
for attachment in item["attachments"]:
|
|
71
|
+
absPath = os.path.abspath(attachment)
|
|
72
|
+
print (absPath)
|
|
73
|
+
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64", "setuptools_scm[toml]>=8"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyreqif"
|
|
7
|
+
description = "very basic python implementation of reqif object model with import and export feature"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
license = { text = "BSD" }
|
|
10
|
+
authors = [{ name = "Eduard Broecker", email = "eduard@gmx.de" }]
|
|
11
|
+
keywords = ["reqif", "requirements", "interchange", "format"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Environment :: Console",
|
|
15
|
+
"License :: OSI Approved :: BSD License",
|
|
16
|
+
"Topic :: Scientific/Engineering",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
]
|
|
19
|
+
requires-python = ">=3.8"
|
|
20
|
+
dependencies = [
|
|
21
|
+
"lxml",
|
|
22
|
+
"oletools",
|
|
23
|
+
"openpyxl",
|
|
24
|
+
"pillow",
|
|
25
|
+
"xlsxwriter",
|
|
26
|
+
]
|
|
27
|
+
dynamic = ["version"]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/ebroecker/pyreqif"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools]
|
|
33
|
+
package-dir = { "" = "src" }
|
|
34
|
+
script-files = ["reqif2html.py", "reqif2xlsx.py", "xlsx2reqif.py"]
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.packages.find]
|
|
37
|
+
where = ["src"]
|
|
38
|
+
|
|
39
|
+
[tool.setuptools_scm]
|
|
40
|
+
tag_regex = "^(?P<prefix>)?(?P<version>[0-9].*)$"
|
pyreqif-0.9/rif2reqif.py
ADDED
pyreqif-0.9/setup.cfg
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
try:
|
|
2
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
3
|
+
except ImportError: # Python < 3.8
|
|
4
|
+
from importlib_metadata import version, PackageNotFoundError
|
|
5
|
+
|
|
6
|
+
try:
|
|
7
|
+
__version__ = version("pyreqif")
|
|
8
|
+
except PackageNotFoundError:
|
|
9
|
+
__version__ = "unknown"
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
import datetime
|
|
4
|
+
import pyreqif.pyreqif
|
|
5
|
+
import pyreqif.rif
|
|
6
|
+
import uuid
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def createDocument(id, title="title", comment="created by pyreqif"):
|
|
10
|
+
mydoc = pyreqif.pyreqif.doc()
|
|
11
|
+
mydoc.addHeader({"identifier": id, "sourceToolId": "pyreqif", "comment": comment, "title": title,
|
|
12
|
+
"creationTime": datetime.datetime.today().isoformat("T", "seconds")})
|
|
13
|
+
return mydoc
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def addDocType(id, mydoc, lastChange=datetime.datetime.today().isoformat("T", "seconds"), longName="doc_type"):
|
|
17
|
+
mydoc.specificationTypes.add({"identifier": id, "lastChange": lastChange, "longName": longName})
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def addDatatype(id, mydoc, type="document", lastChange=datetime.datetime.today().isoformat("T", "seconds"),
|
|
21
|
+
longName="xhtml", values=None):
|
|
22
|
+
if values is None:
|
|
23
|
+
mydoc.addDatatype({"identifier": id, "type": type, "lastChange": lastChange, "longName": longName})
|
|
24
|
+
else:
|
|
25
|
+
mydoc.addDatatype(
|
|
26
|
+
{"identifier": id, "type": type, "lastChange": lastChange, "longName": longName, "values": values})
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def addSpecRelationType(id, mydoc, longName, lastChange=datetime.datetime.today().isoformat("T", "seconds")):
|
|
30
|
+
mydoc.addSpecRelationType({"identifier": id, "longName": longName, "lastChange": lastChange})
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def addSpecRelationGroup(mydoc, id, sourceDoc, targetDoc, longName, longNameOfType, specRelationRefs,
|
|
34
|
+
lastChange=datetime.datetime.today().isoformat("T", "seconds")):
|
|
35
|
+
mydoc.addSpecRelationGroup({"identifier": id, "longName": longName, "sourceDoc": sourceDoc,
|
|
36
|
+
"targetDoc": targetDoc, "lastChange": lastChange,
|
|
37
|
+
"longNameOfType": longNameOfType, "specRelationRefs": specRelationRefs})
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def addReqType(specObjId, specObjLongName, specAttribId, collumName, typeRef, mydoc, type="complex",
|
|
41
|
+
lastChange=datetime.datetime.today().isoformat("T", "seconds"), multiValued=False):
|
|
42
|
+
mydoc.addRequirementType({"identifier": specObjId, "longName": specObjLongName, "lastChange": lastChange,
|
|
43
|
+
specAttribId: {"identifier": specAttribId, "typeRef": typeRef, "type": type,
|
|
44
|
+
"lastChange": lastChange, "longName": collumName,
|
|
45
|
+
"multiValued": multiValued}})
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def addReq(id, specType, content, reqTypeRef, mydoc, longName=None, contentRef=None,
|
|
49
|
+
lastChange=datetime.datetime.today().isoformat("T", "seconds")):
|
|
50
|
+
value = {"attributeRef": reqTypeRef}
|
|
51
|
+
if contentRef is not None:
|
|
52
|
+
value["type"] = "enum"
|
|
53
|
+
value["contentRef"] = contentRef
|
|
54
|
+
else:
|
|
55
|
+
value["content"] = content
|
|
56
|
+
value["type"] = "embeddedDoc"
|
|
57
|
+
req = {"typeRef": specType, "identifier": id, "lastChange": lastChange,
|
|
58
|
+
"values": {id: value}}
|
|
59
|
+
if longName is not None:
|
|
60
|
+
req["longName"] = longName
|
|
61
|
+
mydoc.addRequirement(req)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def addRelation(sourceId, targetId, mydoc, id, type, longName=None,
|
|
65
|
+
lastChange=datetime.datetime.today().isoformat("T", "seconds")):
|
|
66
|
+
relation = {"identifier": id, "lastChange": lastChange}
|
|
67
|
+
relation["sourceRef"] = sourceId
|
|
68
|
+
relation["targetRef"] = targetId
|
|
69
|
+
relation["typeRef"] = type
|
|
70
|
+
if longName is not None:
|
|
71
|
+
relation["longName"] = longName
|
|
72
|
+
mydoc.addRelation(relation)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def creatUUID(itemId=None):
|
|
76
|
+
if itemId is not None:
|
|
77
|
+
return "_" + str(uuid.uuid1(int(itemId)))
|
|
78
|
+
else:
|
|
79
|
+
return "_" + str(uuid.uuid1())
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def createHierarchHead(longName, typeRef, id=None, lastChange=datetime.datetime.today().isoformat("T", "seconds")):
|
|
83
|
+
if id is None:
|
|
84
|
+
id = creatUUID()
|
|
85
|
+
return pyreqif.pyreqif.hierarchy(
|
|
86
|
+
**pyreqif.rif.reqif2py({"identifier": id, "longName": longName, "typeRef": typeRef, "lastChange": lastChange}))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def createHierarchElement(reqid, id=None, lastChange=datetime.datetime.today().isoformat("T", "seconds")):
|
|
90
|
+
if id is None:
|
|
91
|
+
id = creatUUID()
|
|
92
|
+
return pyreqif.pyreqif.hierarchy(
|
|
93
|
+
**pyreqif.rif.reqif2py({"identifier": id, "lastChange": lastChange, "objectRef": reqid}))
|
|
@@ -6,8 +6,10 @@ import os.path
|
|
|
6
6
|
import pyreqif.ole2rtf
|
|
7
7
|
from lxml import etree
|
|
8
8
|
import sys
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# reload(sys)
|
|
12
|
+
# sys.setdefaultencoding('utf8')
|
|
11
13
|
|
|
12
14
|
def create_html(item, cols, depth, basepath):
|
|
13
15
|
tempReq = {}
|
|
@@ -62,7 +64,7 @@ def create_html(item, cols, depth, basepath):
|
|
|
62
64
|
return htmlOutput
|
|
63
65
|
|
|
64
66
|
|
|
65
|
-
def dump(myDoc, outfile, basepath
|
|
67
|
+
def dump(myDoc, outfile, basepath=None):
|
|
66
68
|
if basepath is None:
|
|
67
69
|
basepath = os.path.dirname(outfile)
|
|
68
70
|
|
|
@@ -80,9 +82,9 @@ def dump(myDoc, outfile, basepath = None):
|
|
|
80
82
|
for child in myDoc.hierarchy:
|
|
81
83
|
for item, depth in myDoc.hierach_iterator(child, cols):
|
|
82
84
|
htmlOutput += create_html(item, cols, depth, basepath)
|
|
83
|
-
# for req in specification:
|
|
84
|
-
# reqObj = myDoc.getReqById(req)
|
|
85
|
-
# htmlOutput += create_html(myDoc.flatReq(reqObj, html=True), cols, 0, basepath)
|
|
85
|
+
# for req in specification:
|
|
86
|
+
# reqObj = myDoc.getReqById(req)
|
|
87
|
+
# htmlOutput += create_html(myDoc.flatReq(reqObj, html=True), cols, 0, basepath)
|
|
86
88
|
htmlOutput += "</table>"
|
|
87
89
|
fp = open(outfile, "wb")
|
|
88
90
|
fp.write(bytes(htmlOutput, "utf8"))
|