Skip to content

Commit

Permalink
use the setuptools.setup package_data parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
0x00b1 committed Jul 7, 2017
1 parent 0c64193 commit 2897fcf
Show file tree
Hide file tree
Showing 124 changed files with 24 additions and 23 deletions.
2 changes: 0 additions & 2 deletions MANIFEST.in
@@ -1,3 +1 @@
include LICENSE

recursive-include artwork *
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion cellprofiler/gui/pipelinecontroller.py
Expand Up @@ -2302,7 +2302,7 @@ def do_analyze_images(self):
##################################

if cellprofiler.preferences.get_wants_pony():
wx.Sound(os.path.join(cellprofiler.icons.path, "HorseWhinnying.wav")).Play()
wx.Sound(os.path.join(cellprofiler.icons.resources, "HorseWhinnying.wav")).Play()

ok, reason = self.__frame.preferences_view.check_preferences()

Expand Down
16 changes: 8 additions & 8 deletions cellprofiler/icons/__init__.py
@@ -1,13 +1,11 @@
import os.path
import sys
import weakref

if hasattr(sys, "frozen"):
path = os.path.split(os.path.abspath(sys.argv[0]))[0]
import pkg_resources

path = os.path.join(path, "artwork")
else:
path = os.path.join(os.path.dirname(os.path.dirname(__path__[0])), "artwork")
images = os.path.join("data", "images")

resources = pkg_resources.resource_filename("cellprofiler", images)

image_cache = weakref.WeakValueDictionary()

Expand All @@ -18,10 +16,12 @@ def get_builtin_image(name):
try:
return image_cache[name]
except KeyError:
image_cache[name] = image = wx.Image(os.path.join(path, name + ".png"))
pathname = os.path.join(resources, name + ".png")

image_cache[name] = image = wx.Image(pathname)

return image


def get_builtin_images_path():
return os.path.join(path, '')
return os.path.join(resources, "")
2 changes: 1 addition & 1 deletion cellprofiler/worker.py
Expand Up @@ -168,7 +168,7 @@ def main():
if sys.platform == "darwin":
from cellprofiler.icons import get_builtin_images_path

icon_path = os.path.join(get_builtin_images_path(), "artwork/CellProfilerIcon.png")
icon_path = os.path.join(get_builtin_images_path(), "data/CellProfilerIcon.png")
os.environ["APP_NAME_%d" % os.getpid()] = "CellProfilerWorker"
os.environ["APP_ICON_%d" % os.getpid()] = icon_path

Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Expand Up @@ -2,7 +2,7 @@
argv-emulation = 0
excludes =
Tkinter
iconfile = ./artwork/CellProfilerIcon.icns
iconfile = ./cellprofiler/data/images/CellProfilerIcon.icns
includes =
appdirs,
h5py.*,
Expand Down Expand Up @@ -38,7 +38,7 @@ packages =
skimage,
zmq
resources =
artwork
./cellprofiler/data/images

[py2exe]
dll_excludes =
Expand Down
18 changes: 10 additions & 8 deletions setup.py
Expand Up @@ -168,8 +168,14 @@ def run(self):
#
if self.distribution.data_files is None:
self.distribution.data_files = []

self.distribution.data_files.append(
("artwork", glob.glob("artwork/*")))
(
"cellprofiler/data/images",
glob.glob("cellprofiler/data/images/*")
)
)

#
# javabridge's jars
#
Expand Down Expand Up @@ -321,7 +327,7 @@ def __compile_command(self):
console=[
{
"icon_resources": [
(1, "artwork/CellProfilerIcon.ico")
(1, "cellprofiler/data/images/CellProfilerIcon.ico")
],
"script": "CellProfiler.py"
}
Expand Down Expand Up @@ -361,15 +367,11 @@ def __compile_command(self):
long_description="",
name="CellProfiler",
package_data={
"artwork": glob.glob(os.path.join("artwork", "*"))
"data": glob.glob(os.path.join("data", "images", "*"))
},
packages=setuptools.find_packages(exclude=[
"*.tests",
"*.tests.*",
"tests.*",
"tests",
"tutorial"
]) + ["artwork"],
]),
setup_requires=[
"pytest"
],
Expand Down
3 changes: 2 additions & 1 deletion tests/modules/__init__.py
Expand Up @@ -25,7 +25,8 @@

__temp_example_images_folder = None

cp_logo_url = "https://raw.githubusercontent.com/CellProfiler/CellProfiler/master/artwork/CP_logo.png"
# FIXME: use a stable URI
cp_logo_url = "https://raw.githubusercontent.com/CellProfiler/CellProfiler/0c64193dd9108934400494fffa41d24f3df1573c/artwork/CP_logo.png"
cp_logo_url_folder, cp_logo_url_filename = cp_logo_url.rsplit("/", 1)
cp_logo_url_shape = (70, 187, 3)

Expand Down

0 comments on commit 2897fcf

Please sign in to comment.