Skip to content

Commit fa23495

Browse files
committed
dist: modernize distribution for twine upload
The `make upload` operation doesn't work anymore, so we need to use twine instead. This calls for a few modernizations to the distribution configuration and procedure.
1 parent 9e3a9cc commit fa23495

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/build/
12
.cache
23
.coverage
34
/.tox/

Makefile

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ MAKE = make
33
PYTHON = python
44
SETUP = $(PYTHON) ./setup.py
55

6-
.PHONY: accept clean cleandocs coverage docs readme sdist upload
6+
.PHONY: accept build clean cleandocs coverage docs opendocs
77

88
help:
99
@echo "Please use \`make <target>' where <target> is one or more of"
@@ -20,6 +20,9 @@ help:
2020
accept:
2121
$(BEHAVE) --stop
2222

23+
build:
24+
$(SETUP) bdist_wheel sdist
25+
2326
clean:
2427
find . -type f -name \*.pyc -exec rm {} \;
2528
find . -type f -name .DS_Store -exec rm {} \;
@@ -36,9 +39,3 @@ docs:
3639

3740
opendocs:
3841
open docs/.build/html/index.html
39-
40-
sdist:
41-
$(SETUP) sdist
42-
43-
upload:
44-
$(SETUP) sdist upload

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def ascii_bytes_from(path, *paths):
7171
"description": DESCRIPTION,
7272
"keywords": KEYWORDS,
7373
"long_description": LONG_DESCRIPTION,
74+
"long_description_content_type": "text/x-rst",
7475
"author": AUTHOR,
7576
"author_email": AUTHOR_EMAIL,
7677
"url": URL,

tests/test_api.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import pytest
1212

13+
import pptx
1314
from pptx.api import Presentation
1415
from pptx.opc.constants import CONTENT_TYPE as CT
1516
from pptx.parts.presentation import PresentationPart
@@ -29,9 +30,7 @@ def it_opens_default_template_on_no_path_provided(self, call_fixture):
2930
@pytest.fixture
3031
def call_fixture(self, Package_, prs_, prs_part_):
3132
path = os.path.abspath(
32-
os.path.join(
33-
os.path.split(__file__)[0], "../pptx/templates", "default.pptx"
34-
)
33+
os.path.join(os.path.split(pptx.__file__)[0], "templates", "default.pptx")
3534
)
3635
Package_.open.return_value.main_document_part = prs_part_
3736
prs_part_.content_type = CT.PML_PRESENTATION_MAIN

tests/test_package.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
"""Unit-test suite for `pptx.package` module."""
44

5+
import os
6+
57
import pytest
68

9+
import pptx
710
from pptx.media import Video
811
from pptx.opc.constants import RELATIONSHIP_TYPE as RT
912
from pptx.opc.package import Part, _Relationship
@@ -21,7 +24,10 @@ class DescribePackage(object):
2124
"""Unit-test suite for `pptx.package.Package` objects."""
2225

2326
def it_provides_access_to_its_core_properties_part(self):
24-
pkg = Package.open("pptx/templates/default.pptx")
27+
default_pptx = os.path.abspath(
28+
os.path.join(os.path.split(pptx.__file__)[0], "templates", "default.pptx")
29+
)
30+
pkg = Package.open(default_pptx)
2531
assert isinstance(pkg.core_properties, CorePropertiesPart)
2632

2733
def it_can_get_or_add_an_image_part(self, image_part_fixture):

0 commit comments

Comments
 (0)