Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
camtron
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
kr69sugu
camtron
Commits
a68f3b37
Commit
a68f3b37
authored
5 years ago
by
Andrews Sobral
Browse files
Options
Downloads
Patches
Plain Diff
fix setup.py for python2.x and 3.x
parent
1880d248
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+2
-0
2 additions, 0 deletions
CMakeLists.txt
setup.py
+17
-14
17 additions, 14 deletions
setup.py
with
19 additions
and
14 deletions
CMakeLists.txt
+
2
−
0
View file @
a68f3b37
...
@@ -46,6 +46,8 @@ if (POLICY CMP0042)
...
@@ -46,6 +46,8 @@ if (POLICY CMP0042)
cmake_policy
(
SET CMP0042 NEW
)
cmake_policy
(
SET CMP0042 NEW
)
endif
()
endif
()
set
(
CMAKE_POSITION_INDEPENDENT_CODE ON
)
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules)
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules)
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
17
−
14
View file @
a68f3b37
...
@@ -15,7 +15,7 @@ To upload the source distribution to PyPi
...
@@ -15,7 +15,7 @@ To upload the source distribution to PyPi
python setup.py sdist
python setup.py sdist
twine upload dist/pybgs-*.tar.gz
twine upload dist/pybgs-*.tar.gz
"""
"""
import
os
,
re
,
sys
,
shutil
,
pathlib
,
platform
,
subprocess
import
os
,
re
,
sys
,
shutil
,
platform
,
subprocess
from
setuptools
import
setup
,
find_packages
,
Extension
from
setuptools
import
setup
,
find_packages
,
Extension
from
setuptools.command.build_ext
import
build_ext
from
setuptools.command.build_ext
import
build_ext
...
@@ -50,7 +50,8 @@ class InstallCMakeLibsData(install_data):
...
@@ -50,7 +50,8 @@ class InstallCMakeLibsData(install_data):
# help would be appriciated
# help would be appriciated
self
.
outfiles
=
self
.
distribution
.
data_files
self
.
outfiles
=
self
.
distribution
.
data_files
class
InstallCMakeLibs
(
install_lib
):
__metaclass__
=
type
class
InstallCMakeLibs
(
install_lib
,
object
):
"""
"""
Get the libraries from the parent distribution, use those as the outfiles
Get the libraries from the parent distribution, use those as the outfiles
...
@@ -100,9 +101,10 @@ class InstallCMakeLibs(install_lib):
...
@@ -100,9 +101,10 @@ class InstallCMakeLibs(install_lib):
for
lib
in
libs
]
for
lib
in
libs
]
# Must be forced to run after adding the libs to data_files
# Must be forced to run after adding the libs to data_files
self
.
distribution
.
run_command
(
"
install_data
"
)
self
.
distribution
.
run_command
(
"
install_data
"
)
super
().
run
()
super
(
InstallCMakeLibs
,
self
).
run
()
class
InstallCMakeScripts
(
install_scripts
):
__metaclass__
=
type
class
InstallCMakeScripts
(
install_scripts
,
object
):
"""
"""
Install the scripts in the build dir
Install the scripts in the build dir
"""
"""
...
@@ -125,9 +127,10 @@ class InstallCMakeScripts(install_scripts):
...
@@ -125,9 +127,10 @@ class InstallCMakeScripts(install_scripts):
# distribution.scripts seems to ensure that the setuptools' record
# distribution.scripts seems to ensure that the setuptools' record
# writer appends them to installed-files.txt in the package's egg-info
# writer appends them to installed-files.txt in the package's egg-info
self
.
distribution
.
scripts
=
scripts_dirs
self
.
distribution
.
scripts
=
scripts_dirs
super
().
run
()
super
(
InstallCMakeScripts
,
self
).
run
()
class
BuildCMakeExt
(
build_ext
):
__metaclass__
=
type
class
BuildCMakeExt
(
build_ext
,
object
):
"""
"""
Builds using cmake instead of the python setuptools implicit build
Builds using cmake instead of the python setuptools implicit build
"""
"""
...
@@ -137,17 +140,17 @@ class BuildCMakeExt(build_ext):
...
@@ -137,17 +140,17 @@ class BuildCMakeExt(build_ext):
"""
"""
for
extension
in
self
.
extensions
:
for
extension
in
self
.
extensions
:
self
.
build_cmake
(
extension
)
self
.
build_cmake
(
extension
)
super
().
run
()
super
(
BuildCMakeExt
,
self
).
run
()
def
build_cmake
(
self
,
extension
:
Extension
):
def
build_cmake
(
self
,
extension
):
"""
"""
The steps required to build the extension
The steps required to build the extension
"""
"""
self
.
announce
(
"
Preparing the build environment
"
,
level
=
3
)
self
.
announce
(
"
Preparing the build environment
"
,
level
=
3
)
build_dir
=
path
lib
.
Path
(
self
.
build_temp
)
build_dir
=
os
.
path
.
join
(
self
.
build_temp
)
extension_path
=
path
lib
.
Path
(
self
.
get_ext_fullpath
(
extension
.
name
))
extension_path
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
self
.
get_ext_fullpath
(
extension
.
name
))
)
os
.
makedirs
(
build_dir
,
exist_ok
=
True
)
os
.
makedirs
(
build_dir
)
os
.
makedirs
(
extension_path
.
parent
.
absolute
(),
exist_ok
=
True
)
os
.
makedirs
(
extension_path
)
python_version
=
str
(
sys
.
version_info
[
0
])
+
"
.
"
+
str
(
sys
.
version_info
[
1
])
python_version
=
str
(
sys
.
version_info
[
0
])
+
"
.
"
+
str
(
sys
.
version_info
[
1
])
# Now that the necessary directories are created, build
# Now that the necessary directories are created, build
...
@@ -168,7 +171,7 @@ class BuildCMakeExt(build_ext):
...
@@ -168,7 +171,7 @@ class BuildCMakeExt(build_ext):
# Build finished, now copy the files into the copy directory
# Build finished, now copy the files into the copy directory
# The copy directory is the parent directory of the extension (.pyd)
# The copy directory is the parent directory of the extension (.pyd)
self
.
announce
(
"
Moving built python module
"
,
level
=
3
)
self
.
announce
(
"
Moving built python module
"
,
level
=
3
)
bin_dir
=
os
.
path
.
join
(
build_dir
)
bin_dir
=
build_dir
self
.
distribution
.
bin_dir
=
bin_dir
self
.
distribution
.
bin_dir
=
bin_dir
pyd_path
=
[
os
.
path
.
join
(
bin_dir
,
_pyd
)
for
_pyd
in
pyd_path
=
[
os
.
path
.
join
(
bin_dir
,
_pyd
)
for
_pyd
in
os
.
listdir
(
bin_dir
)
if
os
.
listdir
(
bin_dir
)
if
...
@@ -192,7 +195,7 @@ with open("README.md", "r") as fh:
...
@@ -192,7 +195,7 @@ with open("README.md", "r") as fh:
setup
(
setup
(
name
=
'
pybgs
'
,
name
=
'
pybgs
'
,
version
=
'
3.0.0.post
0
'
,
version
=
'
3.0.0.post
1
'
,
author
=
'
Andrews Sobral
'
,
author
=
'
Andrews Sobral
'
,
author_email
=
'
andrewssobral@gmail.com
'
,
author_email
=
'
andrewssobral@gmail.com
'
,
url
=
'
https://github.com/andrewssobral/bgslibrary
'
,
url
=
'
https://github.com/andrewssobral/bgslibrary
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment