Skip to content

Commit

Permalink
dist: modernize distribution for twine upload
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
scanny committed Aug 29, 2023
1 parent 9e3a9cc commit fa23495
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build/
.cache
.coverage
/.tox/
Expand Down
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ MAKE = make
PYTHON = python
SETUP = $(PYTHON) ./setup.py

.PHONY: accept clean cleandocs coverage docs readme sdist upload
.PHONY: accept build clean cleandocs coverage docs opendocs

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

build:
$(SETUP) bdist_wheel sdist

clean:
find . -type f -name \*.pyc -exec rm {} \;
find . -type f -name .DS_Store -exec rm {} \;
Expand All @@ -36,9 +39,3 @@ docs:

opendocs:
open docs/.build/html/index.html

sdist:
$(SETUP) sdist

upload:
$(SETUP) sdist upload
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def ascii_bytes_from(path, *paths):
"description": DESCRIPTION,
"keywords": KEYWORDS,
"long_description": LONG_DESCRIPTION,
"long_description_content_type": "text/x-rst",
"author": AUTHOR,
"author_email": AUTHOR_EMAIL,
"url": URL,
Expand Down
5 changes: 2 additions & 3 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import pytest

import pptx
from pptx.api import Presentation
from pptx.opc.constants import CONTENT_TYPE as CT
from pptx.parts.presentation import PresentationPart
Expand All @@ -29,9 +30,7 @@ def it_opens_default_template_on_no_path_provided(self, call_fixture):
@pytest.fixture
def call_fixture(self, Package_, prs_, prs_part_):
path = os.path.abspath(
os.path.join(
os.path.split(__file__)[0], "../pptx/templates", "default.pptx"
)
os.path.join(os.path.split(pptx.__file__)[0], "templates", "default.pptx")
)
Package_.open.return_value.main_document_part = prs_part_
prs_part_.content_type = CT.PML_PRESENTATION_MAIN
Expand Down
8 changes: 7 additions & 1 deletion tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

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

import os

import pytest

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

def it_provides_access_to_its_core_properties_part(self):
pkg = Package.open("pptx/templates/default.pptx")
default_pptx = os.path.abspath(
os.path.join(os.path.split(pptx.__file__)[0], "templates", "default.pptx")
)
pkg = Package.open(default_pptx)
assert isinstance(pkg.core_properties, CorePropertiesPart)

def it_can_get_or_add_an_image_part(self, image_part_fixture):
Expand Down

0 comments on commit fa23495

Please sign in to comment.