Skip to content

Commit 7161ce7

Browse files
author
Steve Canny
committed
opc: transplant opc module from python-pptx
Necessarily a big hairy commit, made somewhat worse because it entailed also converting from objectify to etree and updating most of the unitutil mocking functions. Most of the files are new, so at least that makes things a bit simpler. This brings the packaging logic local, removing the dependency on python-opc. This is to avoid package syncronization problems, at least until the packaging logic becomes boringly stable.
1 parent 4cda9a3 commit 7161ce7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+4898
-290
lines changed

docx/__init__.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
# -*- coding: utf-8 -*-
2-
#
3-
# __init__.py
4-
#
5-
# Copyright (C) 2012, 2013 Steve Canny scanny@cisco.com
6-
#
7-
# This module is part of python-docx and is released under the MIT License:
8-
# http://www.opensource.org/licenses/mit-license.php
92

103
from docx.api import Document # noqa
114

125
__version__ = '0.3.0dev1'
136

147

15-
from opc import PartFactory
16-
from opc.constants import CONTENT_TYPE as CT
8+
# register custom Part classes with opc package reader
179

18-
from docx.parts import _Document
10+
from docx.opc.constants import CONTENT_TYPE as CT
11+
from docx.opc.package import PartFactory
1912

13+
from docx.parts import _Document
2014

2115
PartFactory.part_type_for[CT.WML_DOCUMENT_MAIN] = _Document
16+
17+
del CT, _Document, PartFactory

docx/api.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
1-
# -*- coding: utf-8 -*-
2-
#
3-
# api.py
4-
#
5-
# Copyright (C) 2012, 2013 Steve Canny scanny@cisco.com
6-
#
7-
# This module is part of python-docx and is released under the MIT License:
8-
# http://www.opensource.org/licenses/mit-license.php
1+
# encoding: utf-8
92

103
"""
114
Directly exposed API functions and classes, :func:`Document` for now.
125
Provides a syntactically more convenient API for interacting with the
13-
opc.OpcPackage graph.
6+
OpcPackage graph.
147
"""
158

169
import os
1710

18-
from opc import OpcPackage
19-
from opc.constants import CONTENT_TYPE as CT
11+
from docx.opc.package import OpcPackage
12+
from docx.opc.constants import CONTENT_TYPE as CT
2013

2114

2215
thisdir = os.path.split(__file__)[0]

docx/opc/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)