Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathsetup.py
More file actions
Latest commit
49 lines (39 loc) · 1.53 KB
/
Copy pathsetup.py
File metadata and controls
49 lines (39 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
fromsetuptools.command.sdistimportsdistas_sdist
importshutil
fromsetuptoolsimportsetup, find_packages
frompathlibimportPath
# Resolve the absolute path to the directory containing this file:
package_root=Path(__file__).resolve().parent
# Get the version from the version.py file
version= {}
version_file=package_root/"map2loop"/"version.py"
withversion_file.open() asfp:
exec(fp.read(), version)
# Read dependencies from dependencies.txt
requirements_file=package_root/"dependencies.txt"
withrequirements_file.open("r") asf:
install_requires= [line.strip() forlineinfifline.strip()]
classCustomSDist(_sdist):
defmake_release_tree(self, base_dir, files):
# 1) Let the normal sdist process run first.
super().make_release_tree(base_dir, files)
map2loop_dir=Path(base_dir) /"map2loop"
# 2) Specify which files to move from the root to map2loop/.
top_level_files= ["dependencies.txt", "LICENSE", "README.md"]
forfilenameintop_level_files:
src=Path(base_dir) /filename
dst=map2loop_dir/filename
# If the source file exists in base_dir, move it to map2loop/.
ifsrc.exists():
shutil.copy(str(src), str(dst))
setup(
name="map2loop",
install_requires=install_requires,
packages=find_packages(exclude=["tests", "tests.*"]),
package_data={"": ['dependencies.txt']},
include_package_data=True,
license="MIT",
cmdclass={
"sdist": CustomSDist,
},
)